src/Kingdom.OrTools.ConstraintSolver.Core/Internal/SearchAgent.cs
/// <summary>
/// Prepares a <see cref="SearchMonitor"/> given the <paramref name="createMonitor"/>. If
/// the Monitor is a <see cref="SolutionCollector"/> then this is used as the
/// <see cref="Collector"/>. Additionally, as it turns out, Optimizations such as Minimize
/// or Maximize are themselves a kind of <see cref="OptimizeVar"/>, which derives from
/// <see cref="SearchMonitor"/>. In other words, optimizations are introduced to the
/// underlying <see cref="Solver"/> model via the Monitors.
/// </summary>
/// <param name="createMonitor"></param>
/// <returns></returns>
Prepares a  given the . If
the Monitor is a  then this is used as the
. Additionally, as it turns out, Optimizations such as Minimize
or Maximize are themselves a kind of , which derives from
. In other words, optimizations are introduced to the
underlying  model via the Monitors.
Prepares a given the . If the Monitor is a then this is used as the . Additionally as it turns out Optimizations such as Minimize or Maximize are themselves a kind of which derives from . In other words optimizations are introduced to the underlying model via the Monitors .
public ISearchAgent Monitor(Func<ISearchAgent, SearchMonitor> createMonitor)
        {
            var m = createMonitor(this).TrackClrObject(Host);
            if (m is SolutionCollector sc)
            {
                Collector = sc;
            }
            Monitors.Add(m);
            return this;
        }
public ISearchAgent Monitor ( Func < ISearchAgent , SearchMonitor > createMonitor ) { var m = createMonitor ( this ) . TrackClrObject ( Host ) ; if ( m is SolutionCollector sc ) { Collector = sc ; } Monitors . Add ( m ) ; return this ; }
Prepares a  given the .
Prepares a given the .
None
createMonitor
Func<ISearchAgent, SearchMonitor>
None