Exemple #1
0
 /// <summary> Starts the solver in a new thread, and immediately returns to the caller.
 /// The handler is called for each solution and at the end of the solver execution.
 /// You can Stop the solver anytime by calling the {@link #Stop()} method.
 /// </summary>
 /// <param name="handler">solution handler
 /// </param>
 public virtual void Start(ISolutionHandler handler)
 {
     lock (this)
     {
         Start(handler, 0);
     }
 }
Exemple #2
0
 /// <summary> Starts the solver in a new thread with the timeout, and immediately returns to the caller.
 /// When the <tt>timeout</tt> milliseconds have been elapsed
 /// since the Start of the solver, it stops the execution.
 /// The handler is called for each solution and at the end of the solver execution.
 /// You can Stop the solver anytime by calling the {@link #Stop()} method.
 /// </summary>
 /// <param name="handler">solution handler
 /// </param>
 /// <param name="timeout">timeout in milliseconds (non-positive value means no timeout)
 /// </param>
 public virtual void Start(ISolutionHandler handler, long timeout)
 {
     lock (this)
     {
         (new SupportClass.ThreadClass(new System.Threading.ThreadStart(new HandlerInvoker(this, handler, timeout).Run))).Start();
     }
 }
Exemple #3
0
 /// <summary> Invokes the handler for each solution.
 /// This method is equivalent to {@link #FindAll(ISolutionHandler, long) FindFirst(handler, 0)}.
 /// </summary>
 /// <param name="handler">solution handler
 /// </param>
 public virtual void FindAll(ISolutionHandler handler)
 {
     lock (this)
     {
         FindAll(handler, 0);
     }
 }
Exemple #4
0
 /// <summary> Invokes the handler for each solution with the timeout.
 /// This method is implemented as follows:
 /// <pre>
 /// ClearBest();
 /// Start(handler, timeout);
 /// Join();
 /// </pre>
 /// </summary>
 /// <param name="handler">solution handler
 /// </param>
 /// <param name="timeout">timeout in milliseconds (non-positive value means no timeout)
 /// </param>
 public virtual void FindAll(ISolutionHandler handler, long timeout)
 {
     lock (this)
     {
         ClearBest();
         Start(handler, timeout);
         Join();
     }
 }
Exemple #5
0
 public HandlerInvoker(Solver enclosingInstance, ISolutionHandler handler, long timeout)
 {
     InitBlock(enclosingInstance);
     this.handler = handler;
     this.timeout = timeout;
 }
Exemple #6
0
 public HandlerInvoker(Solver enclosingInstance, ISolutionHandler handler, long timeout)
 {
     InitBlock(enclosingInstance);
     _handler = handler;
     _timeout = timeout;
 }
Exemple #7
0
 /// <summary> Starts the solver in a new thread, and immediately returns to the caller.
 /// The handler is called for each solution and at the end of the solver execution.
 /// You can Stop the solver anytime by calling the {@link #Stop()} method.
 /// </summary>
 /// <param name="handler">solution handler
 /// </param>
 public virtual void Start(ISolutionHandler handler)
 {
     lock (this)
     {
         Start(handler, 0);
     }
 }
Exemple #8
0
 /// <summary> Starts the solver in a new thread with the timeout, and immediately returns to the caller.
 /// When the <tt>timeout</tt> milliseconds have been elapsed
 /// since the Start of the solver, it stops the execution.
 /// The handler is called for each solution and at the end of the solver execution.
 /// You can Stop the solver anytime by calling the {@link #Stop()} method.
 /// </summary>
 /// <param name="handler">solution handler
 /// </param>
 /// <param name="timeout">timeout in milliseconds (non-positive value means no timeout)
 /// </param>
 public virtual void Start(ISolutionHandler handler, long timeout)
 {
     lock (this)
     {
         (new SupportClass.ThreadClass(new System.Threading.ThreadStart(new HandlerInvoker(this, handler, timeout).Run))).Start();
     }
 }
Exemple #9
0
 /// <summary> Invokes the handler for each solution with the timeout.
 /// This method is implemented as follows:
 /// <pre>
 /// ClearBest();
 /// Start(handler, timeout);
 /// Join();
 /// </pre>
 /// </summary>
 /// <param name="handler">solution handler
 /// </param>
 /// <param name="timeout">timeout in milliseconds (non-positive value means no timeout)
 /// </param>
 public virtual void FindAll(ISolutionHandler handler, long timeout)
 {
     lock (this)
     {
         ClearBest();
         Start(handler, timeout);
         Join();
     }
 }
Exemple #10
0
 /// <summary> Invokes the handler for each solution.
 /// This method is equivalent to {@link #FindAll(ISolutionHandler, long) FindFirst(handler, 0)}.
 /// </summary>
 /// <param name="handler">solution handler
 /// </param>
 public virtual void FindAll(ISolutionHandler handler)
 {
     lock (this)
     {
         FindAll(handler, 0);
     }
 }