Eplex: Harnessing Mathematical Programming Solvers for

Download Report

Transcript Eplex: Harnessing Mathematical Programming Solvers for

Eplex: Harnessing Mathematical
Programming Solvers for
Constraint Logic Programming
Kish Shen and Joachim Schimpf
IC-Parc
© Imperial College London
Introduction
• Motivation



Use state-of-the-art mathematical programming tools
Use CLP for modelling
Build hybrid solvers (MP - CP - LS)
• Eplex



Page 2
Interface to XPRESS-MP (Dash) and CPLEX (ILOG)
Developed and used at IC-Parc since 1997
Development driven by application requirements
IC-Parc
Possible Uses From Within ECLiPSe
• Black-box
– If problem is suitable for LP/QP/MIP/MIQP as a whole
– But: Only one solution, non-incremental, rounding errors
• Incrementality and multiple instances
– Results explicitly retrieved
– Multiple independent subproblems
• Hybrid
– Solvers work on (possibly overlapping) subproblems
– Programmed cooperation strategy
– Data-driven triggering
• Low-level interface
Page 3
© Imperial College London
Why integrate into CLP enviroment?
• CP
–
–
–
–
–
Page 4
General constraints
Pruning algorithm
Optimization via b&b
Programmed search
Open system
• LP/MIP
– Linear+integrality constraints
– Optimisation algorithm
– Black box search
– Closed system
© Imperial College London
Eplex Constraints
•
Constraints
–
–
–
–
–
•
Benefit from CLP modelling
–
–
–
–
Predicate abstraction
Lists, arrays, structures
Recursion and loops
Metaprogramming
Linear expressions
–
–
–
–
–
–
Page 5
Vars $:: Min..Max
Expr1 $= Epxr2
Expr1 $>= Epxr2
Expr1 $=< Expr2
integers(Vars)
•
X
123 3.4
+Expr
-Expr
E1+E2 E1-E2 CE*E1
sum( List )
List1 * List2
© Imperial College London
Transportation Problem Model
:- lib(eplex).
main(Cost, Vars) :Vars = [A1, A2, A3, B1, B2, B3, C1, C2, C3, D1, D2,
D3],
Vars $:: 0.0..1.0Inf,
A1
B1
C1
D1
+
+
+
+
A2
B2
C2
D2
+
+
+
+
A3
B3
C3
D3
$=
$=
$=
$=
200,
400,
300,
100,
A1 + B1 + C1 + D1 $=< 500,
A2 + B2 + C2 + D2 $=< 300,
A3 + B3 + C3 + D3 $=< 400,
eplex_solver_setup(min(
10*A1 + 7*A2 + 11*A3 +
8*B1 + 5*B2 + 10*B3 +
5*C1 + 5*C2 + 8*C3 +
9*D1 + 3*D2 + 7*D3), Cost).
Page 6
IC-Parc
Summary: Eplex as black-box solver
• CLP modelling / LP or MIP solving
– 1. Do modelling and transformations in ECLiPSe
– 2. Load model into CPLEX/XPRESS-MP and solve using LP or MIP solver
– 3. Pass cost and solution values back to ECLiPSe
ECLiPSe
External Solver
variables & bounds
X1 X2
solution values
constraints
... Xm
c1
=
c2
=<
cn
>=
= Cost
Obj
cost
LP / MIP search
Page 7
IC-Parc
Problems with Integrating MP Solvers
• Solvable constraint class severely limited
– Pure LP/QP/MIP/MIQP
• Numerical problems
– The external solvers use floating-point numbers, subject to rounding errors
– Other ECLiPSe solvers are usually precise (intervals or rational numbers)
– Instantiating the ECLiPSe variables to inexact values may cause other
implementations of the constraints to fail!
• Lack of incrementality
– Cannot find alternative optima
– Cannot add constraints or variables
• MIP search is a straightjacket
– A complex search process inside the black box
– Hard to control (via dozens of parameters)
– Hard to add problem-specific heuristics
• Unsuitable for solver cooperation!
Page 8
© Imperial College London
Eplex solver as compound constraint
setup
solver
Solver triggered by events, then:
• new bounds and constraints are
sent to the external solver
X1 X2
... Xm
• external solver is run
c1
=
• cost bound (or failure) is exported
c2
=<
• solution values are exported and
ECLiPSe variables annotated
(optional)
cn
>=
Page 9
Obj
= Cost
IC-Parc
External
Solver
Control Flow in Classical MIP Solver
Choice
Simplex
step
Solve continuous
relaxation
Choice
Control Flow with Constraint Propagation
Search/Choice
constraints
Propagation phase
Search/Choice
Control Flow with Constraint Propagation
Eplex instance demon can be integrated similar to a global
constraint
Search/Choice
constraints
eplex instances
Propagation phase
• data driven
• priority order
Search/Choice
Summary: Eplex in a hybrid setting
• CLP modelling and search / LP solving
–
–
–
–
1. Do modelling and transformations in ECLiPSe
2. Load relaxed model into external solver
3. Solve relaxed problem externally and get cost and solutions back
4. Do one search step (choice) in ECLiPSe
ECLiPSe
update bounds
CPLEX / XPRESS-MP
X1 X 2
relaxed solutions
constraints
cost
Search
Page 13
... Xm
c1
=
c2
=<
cn
>=
= Cost
Obj
Simplex
IC-Parc
Performance
• Branching in ECLiPSe vs MIP branching:
– Time per LP solve is similar
– Depth-first default (more complex state in CP engine)
– MIP can exploit more special structure
• Memory
– Temporary data structures during constraint generation
– Duplicate representations in hybrid settings
• Overheads not prohibitive
– Largest problems solved >600000 vars, > 900000 cstrs
Page 14
© Imperial College London