Download Mosel user guide

Transcript
Contents
I
Using the Mosel language
1
Introduction
What you need to know before using Mosel . . . . . . . . . . . . . . . . . . . . . . . . .
Symbols and conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The structure of this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2
2
3
4
1 Getting started with Mosel
1.1 The chess set problem: description . . . . . .
1.1.1 A first formulation . . . . . . . . . . .
1.2 Solving the chess set problem . . . . . . . . .
1.2.1 Building the model . . . . . . . . . . .
1.2.2 Obtaining a solution using Mosel . . .
1.2.3 Running Mosel from a command line
1.2.4 Using Xpress-IVE . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
5
5
5
6
6
7
8
9
2 Some illustrative examples
2.1 The burglar problem . . . . . . . . . . . . . . . . . . . .
2.1.1 Model formulation . . . . . . . . . . . . . . . . .
2.1.2 Implementation . . . . . . . . . . . . . . . . . . .
2.1.3 The burglar problem revisited . . . . . . . . . . .
2.2 A blending example . . . . . . . . . . . . . . . . . . . . .
2.2.1 Model formulation . . . . . . . . . . . . . . . . .
2.2.2 Implementation . . . . . . . . . . . . . . . . . . .
2.2.3 Re-running the model with new data . . . . . .
2.2.4 Reading data from spreadsheets and databases
2.2.4.1 Spreadsheet example . . . . . . . . . .
2.2.4.2 Database example . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
10
10
10
10
13
14
14
15
16
17
17
18
3 More advanced modeling features
3.1 A transport example . . . . . . . . . . . . . . . . .
3.1.1 Model formulation . . . . . . . . . . . . . .
3.1.2 Implementation . . . . . . . . . . . . . . . .
3.2 Conditional generation — the | operator . . . . .
3.2.1 Conditional variable creation and create
3.3 Reading sparse data . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
19
19
19
20
22
22
23
4 Integer Programming
4.1 Integer Programming entities in Mosel . . . . . . . . .
4.2 A project planning model . . . . . . . . . . . . . . . . .
4.2.1 Model formulation . . . . . . . . . . . . . . . . .
4.2.2 Implementation . . . . . . . . . . . . . . . . . . .
4.3 The project planning model using Special Ordered Sets
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
25
25
27
27
28
29
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
5 Overview of subroutines and reserved words
30
5.1 Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.2 Reserved words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
ii
Xpress-Mosel User Guide