Table of Contents

Class SolutionEvent

Namespace
OptalCP
Assembly
OptalCP.dll

An event emitted when the solver finds a solution.

public sealed class SolutionEvent
Inheritance
SolutionEvent
Inherited Members

Remarks

An event emitted by Solver when a solution is found.

The event can be intercepted by setting the Solver.OnSolution callback. The event contains the solution, solving time so far, and the result of solution verification.

See also:

Properties

Solution

The solution containing values for all variables and the objective value.

public Solution Solution { get; }

Property Value

Solution

Remarks

The solution contains values of all variables in the model (including optional variables) and the value of the objective (if the model specified one).

See also:

  • Solution — for accessing variable values.

SolveTime

The duration of the solve at the time the solution was found, in seconds.

public double SolveTime { get; }

Property Value

double

Valid

Result of the verification of the solution.

public bool? Valid { get; }

Property Value

bool?

Remarks

When parameter Parameters.verifySolutions is set to True (the default), 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:

  • None - 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.