src/Kingdom.OrTools.ConstraintSolver.Core/OrProblemSolverBase.cs
// TODO: TBD: PrepareSearchMonitors is perhaps closer to a fluent style...
/// <summary>
/// Override to prepare the <see cref="SearchMonitor"/> or monitors for the
/// <paramref name="agent"/> and corresponding <see cref="Solver"/>. If called, the base
/// method should be called after preparing any other required Monitors. By default, a
/// single <see cref="SolutionCollector"/> is prepared.
/// </summary>
/// <param name="agent"></param>
/// <param name="variables"></param>
/// <returns></returns>
Override to prepare the  or monitors for the
and corresponding . If called, the base
method should be called after preparing any other required Monitors. By default, a
single  is prepared.
Override to prepare the or monitors for the and corresponding . If called the base method should be called after preparing any other required Monitors . By default a single is prepared .
protected virtual ISearchAgent PrepareSearchMonitors(ISearchAgent agent, params IntVar[] variables)
        {
            if (!agent.HasSolutionCollector<SolutionCollector>())
            {
                agent.Monitor(a =>
                {
                    var m = a.Solver.MakeAllSolutionCollector();
                    var vector = new IntVarVector().TrackClrObject(this);
                    foreach (var v in variables) vector.Add(v);
                    m.Add(vector);
                    return m;
                });
            }
            return agent;
        }
protected virtual ISearchAgent PrepareSearchMonitors ( ISearchAgent agent , params IntVar [ ] variables ) { if ( ! agent . HasSolutionCollector < SolutionCollector > ( ) ) { agent . Monitor ( a => { var m = a . Solver . MakeAllSolutionCollector ( ) ; var vector = new IntVarVector ( ) . TrackClrObject ( this ) ; foreach ( var v in variables ) vector . Add ( v ) ; m . Add ( vector ) ; return m ; } ) ; } return agent ; }
Override to prepare the  or monitors for the
and corresponding .
Override to prepare the or monitors for the and corresponding .
// Start with a single all-solution-collector.
None
agent
ISearchAgent
None
variables
None