Type Alias: SolutionEvent
SolutionEvent: {
solution
:Solution
;solveTime
:number
;valid
:true
; }
An event emitted by Solver when a solution is found.
The event can be intercepted by calling Solver.on('solution', ...). The event contains the solution, solving time so far, and the result of solution verification.
Type declaration
solution
solution:
Solution
Solution of the model.
The solution contains values of all variables in the model (including optional variables) and the value of the objective (if the model specified one).
Note that in the evaluation version of OptalCP, the values of variables in
the solution are masked and replaced by value absent (null
in
JavaScript).
solveTime
solveTime:
number
The duration of the solve at the time the solution was found, in seconds.
valid?
optional
valid:true
Result of the verification of the solution.
When parameter Parameters.verifySolutions is set to true (the default), then the solver verifies all solutions found. The verification checks that all constraints in the model are satisfied and that the objective value is computed correctly.
The verification is done using a separate code (not used during the search). The point is to independently verify the correctness of the solution.
Possible values are:
undefined
- the solution was not verified (because the parameter Parameters.verifySolutions was not set).true
- the solution was verified and correct.
The value can never be false
because, in that case, the solver ends with an
error.