update on the - maximal softwarecplex 8.0.0: iisfind=1 cplex 8.0.0: infeasible problem. 0 simplex...

30
Update on the AMPL /Solver Interface Library Robert Fourer Dept. of Industrial Engineering and Management Sciences Northwestern University [email protected] David M. Gay AMPL Optimization LLC [email protected] [email protected]

Upload: others

Post on 21-Feb-2021

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

Update on theAMPL/Solver Interface Library

Robert FourerDept. of Industrial Engineering

and Management SciencesNorthwestern [email protected]

David M. GayAMPL Optimization LLC

[email protected]@ampl.com

Page 2: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

Outline1. Components of AMPL2. Problem areas (historical view)3. Design flexibility4. Documented solver-interface library5. Undocumented stuff6. Work in progress7. Other environments, e.g.,

MATLAB, Java, VB8. Summary

Page 3: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

1. Components of AMPL

a. Model = declared problemkeyboard-math notationgeneral indexing sets

b. Commands to show statedisplay, print, printf

c. Commands to change state— retaining declared relations

Page 4: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

d. Separate data specificationdata sectionsread table

database or spreadsheetetc. via custom handlers

letcall

Page 5: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

2. Problem Areas (historical view)

LinearIntegerNonlinear

AD for derivativesauto. use of partial separability

for Hessians (by AD)Complementarity

Page 6: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

Forthcominglogic programmingstochastic programming

Page 7: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

3. Design Flexibility

Processes filesstdin = interactiveor server mode for

GUIs, COM objectsSeparate solvers

general solver interface lib.solvers can run elsewhere

Imported function librariesTable handlers

Page 8: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

Separation of model & data, and automaticrecomputations permit

• interactive model development• solving similar problems:

same modelbut updated dataor all new data

Page 9: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

4. Documented Solver-Interface Library

Readers read .nl files and set up datastructures for efficient evaluation of desiredinformation:f_read for LPs and MILPsqp_read for QPsfg_read for f and ∇ fpfgh_read for f, ∇ f, and ∇2 f

Page 10: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

Library routines compute f, ∇ f for• objectives• constraint bodies

∗ all at once∗ singly∗ subarray

• Hessian of the LagrangianH = ∇2 f +

iΣ λ i ∇2 c i

Page 11: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

Readers provide Jacobian sparsity.sphsetup gives sparsity of Hessian H.

Page 12: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

5. Undocumented stuff

Statuses and suffixesReturning (new) suffixesSymbolic suffixessolve_result andsolve_result_num

Page 13: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

Example of (basis) statuses...ampl: model diet.mod; data diet2a.dat;ampl: solve;MINOS 5.5: optimal solution found.13 iterations, objective 118.0594032ampl: display Buy;Buy [*] :=BEEF 5.36061CHK 2FISH 2HAM 10MCH 10MTL 10SPG 9.30605TUR 2;

Page 14: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

ampl: minimize mtl: Buy[’MTL’];ampl: solve mtl;MINOS 5.5: optimal solution found.1 iterations, objective 5.810623557ampl: display Buy.lb, Buy, Buy.ub,ampl? Buy.status;: Buy.lb Buy Buy.ub Buy.status :=BEEF 2 10 10 uppCHK 2 2 10 lowFISH 2 2 10 lowHAM 2 10 10 uppMCH 2 10 10 uppMTL 2 5.81062 10 basSPG 2 8.85604 10 basTUR 2 2 10 low;

Page 15: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

ampl: display Diet.body, Diet,ampl? Diet.status;: Diet.body Diet Diet.status :=A 1956.29 0 basB1 1036.26 0 basB2 700 0.404585 lowC 1682.51 0 basCAL 19794.6 0 basNA 50000 -0.00306905 upp;

Page 16: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

ampl: option *status_table;option astatus_table ’\0 in normal state (in problem)\1 drop removed by drop command\2 pre eliminated by presolve\3 fix fixed by fix command\4 sub defined variable, substituted out\5 unused not used in current problem\6 log logical constraint in current problem\option sstatus_table ’\0 none no status assigned\1 bas basic\2 sup superbasic\3 low nonbasic <= (normally =) lower bound\4 upp nonbasic >= (normally =) upper bound\5 equ nonbasic at equal lower and upper bounds\6 btw nonbasic between bounds\

Page 17: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

ampl: print $solve_result_table;

0 solved100 solved?200 infeasible300 unbounded400 limit500 failure

ampl: display solve_result,ampl: solve_result_num;solve_result = solvedsolve_result_num = 0

Page 18: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

ampl: reset data; data diet2.dat;ampl: solve;MINOS 5.5: infeasible problem.9 iterationsObjective = Total_Costampl: display solve_result,ampl? solve_result_num;solve_result = infeasiblesolve_result_num = 200

To set solve_result, solvers assignsolve_result_num.

Page 19: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

Example of solver-declared suffix:

ampl: option solver cplex;ampl: option cplex_options ’iisfind=1’;ampl: solve;CPLEX 8.0.0: iisfind=1CPLEX 8.0.0: infeasible problem.0 simplex iterations (0 in phase I)Returning iis of 7 variables and 2 constraints.constraint.dunbdd returned6 extra dual simplex iterations for ray (4 in phase I)

suffix iis symbolic OUT;

Page 20: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

option iis_table ’\0 non not in the iis\1 low at lower bound\2 fix fixed\3 upp at upper bound\suffix dunbdd OUT;Objective = Total_Cost

Page 21: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

ampl: display Buy.iis;Buy.iis [*] :=BEEF uppCHK lowFISH lowHAM uppMCH nonMTL uppSPG lowTUR low;

Page 22: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

ampl: display Diet.iis;Diet.iis [*] :=A nonB1 nonB2 lowC non

CAL nonNA upp;

Page 23: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

ampl: display {i in 1.._nvars:ampl? P_var[i].iis != ’non’}ampl? (_varname[i], _var[i].iis);: _varname[i] _var[i].iis :=1 "Buy[’BEEF’]" upp2 "Buy[’CHK’]" low3 "Buy[’FISH’]" low4 "Buy[’HAM’]" upp6 "Buy[’MTL’]" upp7 "Buy[’SPG’]" low8 "Buy[’TUR’]" low;

Page 24: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

6. Work in Progress

Logic programming extensions:New logical operators

numberof==>, <==, <==>exactly, atleast, atmostalldiffcount

Page 25: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

Solver interface library evaluates new logicaloperators

— but treewalk may be needed to build solverdata structures.

Example: Fourer’s interface to ILOG Solver.

Example: interface to Globsol (still inprogress).

Page 26: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

Plan for stochastic programming is tointroduce random variables, assigneddistributions by let. Solvers could do theirown sampling or ask the interface library tosample from the distributions specified by inthe AMPL session.

Solvers would treat derived random variablesmuch like defined variables.

Page 27: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

7. Other environments (MATLAB, Java, etc.)

Mex functionsamplfunc (dense Jacobians)

andspamfunc (sparse Jacobians)

make problem information (f, ∇ f, etc.)available to MATLAB — described since 1997in Hooking Your Solver to AMPL.

Page 28: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

Similar arrangements can be made for Java byJava Native Interface. Had preliminary JNIinterface in 2000; not yet pursued further, inpart because of no perceived interest.

John Chinneck reports an interface to VB.

Similar interface to .NET seems plausible.

Page 29: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

8. Summary

Some new stuff, such asstatuses, suffixes, solve_result

work now but need better documentation.

Logic-programming extensions are partly done;variables in subscripts are

not yet done andwill require interface library extensions.

Page 30: Update on the - Maximal SoftwareCPLEX 8.0.0: iisfind=1 CPLEX 8.0.0: infeasible problem. 0 simplex iterations (0 in phase I) Returning iis of 7 variables and 2 constraints. constraint.dunbdd

Some interfacing to other systems works now;more would be good. Watch

http://www.ampl.com

for news of enhancements. Other pointers:

http://www.ampl.com/hooking.html

for Hooking Your Solver to AMPL and

http://www.ampl.com/BOOK

for AMPL book info.