Professor: Q. Louveaux.
If you have any question about the exercises or the projects, come to my office or drop me a line to make an appointment.
The practical part of this course is twofold:
Indeed, these projects focus on modelling and implementing models, which are the most important skills to get from this course; only the first one is evaluated during the exam.
thales02.montefiore.ulg.ac.be
. Credentials (login starting with od_group
) will be provided for the second project. To get access to the required tools, first type this command: GUROBI_HOME=/usr/ julia E "Pkg.add(\"JuMP\"); Pkg.add(\"CPLEX\"); Pkg.add(\"Gurobi\")"
. Julia is then available as julia
. An exercise book is being prepared for this course. The current version is already available, and contains the exercises done during the exercise sessions and some supplementary ones. Not all exercises are part of the course syllabus; please refer to the contents of the exercise sessions.
Download current version (last edition: January 03 2017 19:01:25).
Be sure to bring your laptop for the first exercise sessions, as it will be required for model implementation exercises.
#  Date  Agenda  Downloads 

1  23 September 2016  A Gentle Introduction to Julia for Optimisation. 
Slides More complete slides. These also contain conic constraints and the Convex.jl modelling layer, which may be useful for the second project. 
2  30 September 2016  MILP modelling 
Statement Julia files: 
3  7 October 2016  Advanced MILP modelling, presentation of the first project 
Statement Julia files: Figures:

4  14 October 2016  Branchandbound algorithm 
Statement Figures:

5  21 October 2016  Formulation comparison 
Statement Julia file: See also: 
6  28 October 2016  Advanced solver usage, Q&A for the project and the exercise sessions 
Slides Julia files:

7  4 November 2016  Constraint programming 
Statement ECLiPSe is a constraintprogramming modelling environment based on Prolog. Download it: ECLiPSe solutions:

4 November 2016  Danger Deadline for the first project  
11 November 2016  Info Day off.  
8  18 November 2016  Correction of the first project, cuts and valid inequalities 
Statement Figures: 
9  25 November 2016  Cuts and valid inequalities 
Info No theoretical course on this day: the exercise session begins at 14:00. Statement Julia files: 
25 November 2016  Danger Deadline for the first part of the second project  
10  2 December 2016  Correction of the second project, modelling with flows 
Info The course will exceptionnally take place in the R75 room. Statement 
9 December 2016  Info No exercise session.  
11  16 December 2016  Solving flow problems 
Statement See also real implementations of these algorithms: 
16 December 2016  Danger Deadline for the second part of the second project  
23 December 2016  Danger Project presentations 
Those exercises partly come from Sébastien Mathieu's work, and have been modified with his consent.
You may use Mathematica (the university offers a license for students) or the CDF Player.
This first project is about the video game Anno 1404. Available files:
Alterations to the statement and the provided files:
storage_capacity_max
),boat_points
),The project must be submitted on the submission platform. The platform is not yet updated for this year. Submissions will be accepted till 4 November, 2016, 23:59:59.
Since December 2, the results are available on the submission platform. The comments are in the following format:
This second project is about scheduling in the paper industry. Available files:
Alterations to the statement and the provided files:
When asking for help with your code: give a meaningful snippet, allowing easy testing; precise whether the tests were carried out on the MS800 machines, Thalès, or your own (with platform and bitness, if relevant). Don't assume any knowledge on my side about your model, only use names defined in the given files: I don't have access to your code before you submit it, I can only guess what is the meaning of all those nice symbols.
Interesting link: How NOT to go about a programming assignment.
Modelling tricks: Applications of optimization with XpressMP, MOSEK Modeling Cookbook, Formulating Integer Linear Programs: A Rogues’ Gallery.
Debugging a MIP model: Detecting the Sources of Model Infeasibility using Gurobi.
Julia is a technical computing programming language, completely free and opensource. Its syntax should be very familiar to MATLAB users. Its environment includes a strong mathematical optimisation community, JuliaOpt.
Hint: a working version of Julia is available on the MS800 machines, albeit far from recent. It is not necessary to follow this procedure on those computers (including Gurobi with a network license). This version of Julia should be sufficient for most of your work (except the new JuMP syntax or lazy constraints).
First, download Julia 0.4 for your platform from their webpage and install it:
Then, install the optimisation packages: JuMP as a modelling layer, Cbc as a free opensource solver. From the Julia prompt:
julia> Pkg.update() julia> Pkg.add("JuMP") julia> Pkg.add("Cbc")
As a final step, you might be interested in installing a much faster (even though closedsource) solver, such as Gurobi. First, download the solver (64bit version) and ask for an academic user license (you must register using your student email address and activate the solver from a university network; a license is only valid for one physical computer). Then, install the Julia wrapper from a Julia shell:
julia> Pkg.add("Gurobi")
For an introduction to the language, see the documentation or Andrew Collier's Month of Julia. For an introduction to JuMP, see the documentation. More detailed examples are available as notebooks (they are not necessarily MILPs!).
Julia also has a more comfortable way of working than a text editor and a console: Juno is a recent IDE for Julia (there is no need to reinstall the packages within Juno), there is also an experimental Eclipse extension for Julia.
The first step is to import the required modules, at least JuMP (and a solver if autodetection does not work):
julia> using JuMP julia> using Cbc # If installed and autodetection does not work julia> using Gurobi # If installed and autodetection does not work
Then create a model (and associate the solver if needed):
julia> m = Model() # No solver: only use autodetected one julia> m = Model(solver=CbcSolver()) # Use Cbc julia> m = Model(solver=GurobiSolver()) # Use Gurobi
Create variables using the @variable
macro (it will automatically create Julia variables):
julia> @variable(m, x) # Variable x, continuous, no bounds julia> @variable(m, y[0:1] >= 10, Int) # Variables y[0] to y[1], integer, greater or equal to 10 julia> @variable(m, z[0:1, 0:1], Bin) # Variables z[0][0], z[0][1], z[1][0], and z[1][1], booleans
Add some constraints with the @constraint
macro:
julia> @constraint(m, sum(y) >= x)
Add an objective using the @objective
macro:
julia> @objective(m, Max, sum(z))
Print the model with the print()
function:
julia> print(m) Max z[0,0] + z[1,0] + z[0,1] + z[1,1] Subject to y[0] + y[1]  x ≥ 0 y[i] ≥ 10, integer, for all i in {0,1} z[i,j] in {0,1} for all i in {0,1}, j in {0,1} x free
Solve the model with the solve()
function:
julia> solve(m)
Get the values for the variables with the getvalue()
function:
julia> getvalue(x) 20.0 julia> getvalue(y) y: 1 dimensions: [0] = 10.0 [1] = 10.0 julia> getvalue(z) z: 2 dimensions: [0,:] [0,0] = 1.0 [0,1] = 1.0 [1,:] [1,0] = 1.0 [1,1] = 1.0
Between the versions 0.12 and 0.13, JuMP changed its syntax. Using the old syntax still works with the new versions, but emit warnings; however, the new syntax does not work with the older versions. The difference is important, as an old version of JuMP is installed on the MS800 machines: only the old syntax works there.
Meaning  JuMP 0.12  JuMP 0.13+ 

Defining a variable  @defVar(model, variable, class) 
@variable(model, variable, class) 
Defining a constraint  @addConstraint(model, constraint) 
@constraint(model, constraint) 
Defining the objective function  @setObjective(model, sense, expression) 
@objective(model, sense, expression) 
Getting the value of a variable after optimisation  getValue(variable) 
getvalue(variable) 
Getting the objective value after optimisation  getObjectiveValue(model) 
getobjectivevalue(model) 
In the shell, type ;
to have access to a standard UNIX shell; type ?
for the help mode (equivalent to using the help()
function).
Last modification: January 03 2017 17:28:15.