Skip to main content

Class: Solution

Solution of a Model. When a model is solved, the solution is stored in this object. The solution contains values of all variables in the model (including optional variables) and the value of the objective (if the model specified one).

Evaluation version of OptalCP

Note that in evaluation version of OptalCP the values of variables in the solution are masked and replaced by value absent (null in JavaScript).

Methods

getEnd

getEnd(variable): null | number

Returns end of the given interval variable in the solution. If the variable is absent in the solution then it returns null.

In evaluation version of OptalCP this function always returns null because real values of variables are masked and replaced by value absent.

Parameters

NameType
variableIntervalVar

Returns

null | number


getObjective

getObjective(): ObjectiveValue

Returns objective value of the solution. If the model did not specify an objective returns undefined. If the objective value is absent (see optional IntExpr) then it returns null.

The correct value is reported even in case of evaluation version of OptalCP.

Returns

ObjectiveValue


getStart

getStart(variable): null | number

Returns start of the given interval variable in the solution. If the variable is absent in the solution then it returns null.

In evaluation version of OptalCP this function always returns null because real values of variables are masked and replaced by value absent.

Parameters

NameType
variableIntervalVar

Returns

null | number


isAbsent

isAbsent(variable): boolean

Returns true if the given variable is absent in the solution, i.e. if its value is absent. See optional IntervalVar.

In evaluation version of OptalCP this function always returns true because real values of variables are masked and replaced by value absent.

Parameters

NameType
variableIntervalVar

Returns

boolean


isPresent

isPresent(variable): boolean

Returns true if the given variable is present in the solution, i.e. if its value is not absent. See optional IntervalVar.

In evaluation version of OptalCP this function always returns false because real values of variables are masked and replaced by value absent.

Parameters

NameType
variableIntervalVar

Returns

boolean