ebook img

Optimisation and Operations Research - Lecture 14: ILPs in Matlab and AMPL PDF

26 Pages·2017·0.35 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Optimisation and Operations Research - Lecture 14: ILPs in Matlab and AMPL

Optimisation and Operations Research Lecture 14: ILPs in Matlab and AMPL Matthew Roughan <[email protected]> http: //www.maths.adelaide.edu.au/matthew.roughan/notes/OORII/ SchoolofMathematicalSciences, UniversityofAdelaide September 12, 2019 Section 1 Integer Programming: Matlab MatthewRoughan(SchoolofMathematicalSciences, UniversityOoOfRAIdIelaide) September12,2019 2/25 Matlab intlinprog Similar to the linprog command in Matlab for linear programs that have variables which can take on real solutions, there exists a command intlinprog for those linear programs that are also constrained to have variables to be integer, i.e., which can only take on the values 0 or 1. That is, intlinprog solves binary linear programming problems of the form  A x ≤ b  minfTx, such that A x = b eq eq x  some x integer i where, f, b, and b are vectors, A and A are matrices, and some of the eq eq the variables are required to be integers. MatthewRoughan(SchoolofMathematicalSciences, UniversityOoOfRAIdIelaide) September12,2019 3/25 MATLAB intlinprog example Commands: for Binary program below > f = [-9; -5; -6; -4]; > A = [6,3,5,2; 0,0,1,1; -1,0,1,0; 0,-1,0,1]; > b = [9; 1; 0; 0]; > Aeq = []; > beq = []; > intcon = [1,2,3,4]; > ub = ones(4,1); > lb = zeros(4,1); > x = intlinprog(f,intcon,A,b,Aeq,beq,lb,ub) Output: x = 1 1 0 0 MatthewRoughan(SchoolofMathematicalSciences, UniversityOoOfRAIdIelaide) September12,2019 4/25 When to use intlinprog Don’t cheat (cid:73) use this to check solutions (cid:73) but solve them the way required in your assignments Yes, you can use it in your project (cid:73) but display understanding (cid:73) show alternatives In general (cid:73) you still need to construct matrices and vectors which is awkward (cid:73) you need to write every constraint, even if they fit a pattern (cid:73) you still need explicit (closed form) constraints and objective functions (cid:73) Matlab doesn’t tell you much about how it does it, and what its limitations are (cid:70) we know the problem might be NP-complete, so this could be an issue MatthewRoughan(SchoolofMathematicalSciences, UniversityOoOfRAIdIelaide) September12,2019 5/25 Section 2 AMPL MatthewRoughan(SchoolofMathematicalSciences, UniversityOoOfRAIdIelaide) September12,2019 6/25 Practical Optimisation Matlab is all very well, but what do real optimisers do? MatthewRoughan(SchoolofMathematicalSciences, UniversityOoOfRAIdIelaide) September12,2019 7/25 Mathematical Modelling Languages There are computer languages designed specifically for optimisation (cid:73) they allow natural expression of LPs, etc. (cid:73) they link to multiple backends to solve the problem (cid:73) they separate the model from the data (cid:73) they link to other tools, e.g., databases, spreadsheets, ... (cid:73) support reuse Common examples: (cid:73) AMPL (cid:73) GAMS (cid:73) AIMMS (cid:73) MPS (not really a modelling language, but is used for standard input) (cid:73) ... MatthewRoughan(SchoolofMathematicalSciences, UniversityOoOfRAIdIelaide) September12,2019 8/25 AMPL = A Mathematical Programming Language Why AMPL? (cid:73) I like it (cid:73) it’s one of the most commonly used (Neos says 59%) (cid:73) lots of backends (cid:73) free student version History (cid:73) designed 1985 by Robert Fourer, David Gay and Brian Kernighan (cid:73) 2003 AMPL Optimization LLC (cid:73) 2012 INFORMS Impact Prize MatthewRoughan(SchoolofMathematicalSciences, UniversityOoOfRAIdIelaide) September12,2019 9/25 Resources The AMPL Book, “AMPL: A Modelling Language for Mathematical Programming”, R.Fourer, D.M.Gay and B.W.Kernighan (cid:73) Online http://ampl.com/resources/the-ampl-book/ Other tutorials (cid:73) www.ieor.berkeley.edu/~atamturk/ieor264/samples/ampl/ ampldoc.pdf Download your own (student) copy of AMPL from (cid:73) AMPL http://ampl.com/try-ampl/download-a-free-demo/ (cid:73) backends from the same place or others (cid:70) there are other backends (we are using lpsolve, and I notice they don’t have a direct link to this anymore). Online solver NEOS http://www.neos-server.org/neos/ https://neos-server.org/neos/solvers/lp: Gurobi/AMPL.html MatthewRoughan(SchoolofMathematicalSciences, UniversityOoOfRAIdIelaide) September12,2019 10/25

Description:
Optimisation and Operations Research. Lecture 14: ILPs in Matlab and AMPL. Matthew Roughan. http://www.maths.adelaide.edu.au/matthew.roughan/ · Lecture_notes/OORII/. School of Mathematical Sciences,. University of Adelaide. July 12, 2017
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.