TD #1
Advanced Mathematical Programming Leo Liberti, CNRS LIX Ecole Polytechnique liberti@lix.polytechnique.fr INF580 — 2017
1 / 18
TD #1 Advanced Mathematical Programming Leo Liberti, CNRS LIX Ecole - - PowerPoint PPT Presentation
TD #1 Advanced Mathematical Programming Leo Liberti, CNRS LIX Ecole Polytechnique liberti@lix.polytechnique.fr INF580 2017 1 / 18 Software Modelling Implementation 2 / 18 Section 1 Software 2 / 18 Structured and flat formulations
1 / 18
2 / 18
2 / 18
◮ Mathematical Programs (MP) describing problems involve sets
◮ For each set of values assigned to the parameters, MP describes
3 / 18
◮ Mathematical Programs (MP) describing problems involve sets
◮ For each set of values assigned to the parameters, MP describes
◮ Humans reason in terms of problems (structured formulations) ◮ Solvers provide solutions for instances (flat formulations) ◮ Need a translation from problems to instances: modelling
3 / 18
◮ AMPL
◮ wonderful syntax close to mathematics ◮ interfaces with lots of solvers, including MINLP (but little
◮ imperative sub-language: poor (no function calls, no libraries) ◮ good for rapid prototyping or “just use the solver”
◮ Python
◮ mixture of declarative (PyOMO) and imperative (Python) ◮ interfaces with many solvers, including SDP (but little
◮ excellent imperative sub-language (Python itself) ◮ good for “doing further stuff with the solution” 4 / 18
◮ Windows (64bit)
◮ MacOS X: open terminal, and type cd ; mkdir ampl ; cd ampl unzip ~/Downloads/ampl_macosx64.zip cd ; echo "export PATH=$PATH:~/ampl" >> ~/.bash_profile source ~/.bash_profile ◮ Linux (64bit): as for MacOS X
5 / 18
6 / 18
7 / 18
8 / 18
◮ Use drawings — they help to think
9 / 18
10 / 18
10 / 18
◮ As you go on with the model, you might find your initial choices
10 / 18
11 / 18
11 / 18
◮ How about:
11 / 18
i∈P
j∈Q
12 / 18
◮ Failure to express “fraction of i going to j” must inspire us!
i∈P
13 / 18
14 / 18
◮ Three files:
◮ file.mod: the model file
◮ file.dat: the data file
◮ file.run: the run file
◮ Run “ampl < file.run” and get results on file or screen 15 / 18
16 / 18
17 / 18
18 / 18