[ library(range_eplex) | The ECLiPSe Libraries | Reference Manual | Alphabetic Index ]

optimize(+Objective, -Cost)

Optimise Objective (minimise or maximise) with the external solver.
Objective
Objective function: min(CostExpr) or max(CostExpr)
Cost
Value of the optimal solution

Description

Objective is either min(Expr) or max(Expr) where Expr is a linear expression (or quadratic if supported by the external solver). This calls the external solver's optimizer and succeeds if it finds an optimum. In this case the problem variables get instantiated to the solution values, and Cost gets bound to the cost of this solution. Note that this will find at most one solution, ie. you won't get alternative optima on backtracking.

This primitive allows the external solver to be used as a black box: ECLiPSe is used as a modeling language and the external solver does all the solving. Linear constraints are first set up, and then this primitive is called to invoke the external solver on these constraints.

Fail Conditions

The solver did not find a solution for Objective.