next up previous index
Next: Advanced Use of Eplex Up: EPLEX: The ECLiPSe/CPLEX Interface Previous: Eplex Instances   Index

Subsections

Black-Box Interface

One possible use of the eplex library is to use ECLiPSe just as a modelling language and let the external solver do all the solving. For that purpose, a high-level interface is provided. It is implemented on top of the eplex eplex instance, and is a single optimization primitive to invoke the external solver, without requiring the user to explicitly declare an eplex instance, set up a solver state and then invoking the solver.

Optimization

After setting up the constraints by posting them to the eplex instance, the external solver's MIP optimizer can be invoked as a black box using


optimize(+Objective, -Cost)

Objective is the objective function as in the set up for an eplex instance (see section 11.3.4). The predicate 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.

Examples

Here is a simple linear program. As long as the optimizer is not invoked, the constraints just delay:

[eclipse 2]: eplex:(X+Y >= 3), eplex:(X-Y =:= 0).

X = X
Y = Y

Delayed goals:
        eplex : (X - Y =:= 0), eplex : (X + Y >= 3)
yes.
Now a call to optimize/2 is added in order to trigger the solver:
[eclipse 3]: eplex:(X+Y >= 3), eplex:(X-Y =:= 0), optimize(min(X), C).

Y = 1.5
X = 1.5
C = 1.5
yes.
(Note that X and Y have not been explicitly declared. They default to reals ranging from -infinity to +infinity.)

By declaring one variable as integer, we obtain a Mixed Integer Problem:

[eclipse 4]: integers([X]), eplex:(X+Y >= 3), eplex:(X-Y =:= 0), optimize(min(X), C).

Y = 2.0
X = 2
C = 2.0
yes.


next up previous index
Next: Advanced Use of Eplex Up: EPLEX: The ECLiPSe/CPLEX Interface Previous: Eplex Instances   Index
Warwick Harvey
2002-05-15