Table Of ContentAlternatives for Programming
in Conjunction with an Algebraic
Modeling Language for Optimization
Robert Fourer
AMPL Optimization Inc.
www.ampl.com — +1 773-336-AMPL
OR 2014
Annual International Conference
of the German Operations Research Society (GOR)
Aachen, 2-5 September 2014
Session TA-21, Tuesday 8:15-9:45,
Optimization Modeling II
Robert Fourer, Alternatives for Programming in an Algebraic Modeling Language 1
OR2014 Aachen —2-5 September 2014 —TA-21 Optimization Modeling II
Alternatives for Programming in Conjunction with
an Algebraic Modeling Language for Optimization
Modeling languages for formulating interpreted scripting languages, and
and analyzing optimization prob- by exposure of their functions
lems are essentially declarative, in through application programming
that they are founded on a symbolic interfaces (APIs). How can scripting
description of a model’s objective and APIs benefit the user of a
function and constraints rather than declarative language, and what do
a procedural specification of how a they offer in comparison to
problem instance is to be generated modeling exclusively in a general-
and solved. Yet successful optimi- purpose language? This presen-
zation modeling languages have tation suggests a variety of answers,
come to offer many of the same through examples that make use of
facilities as procedural, high-level advanced AMPL scripting features
programming languages, in two and the new AMPL APIs for Java,
ways: by extension of their syntax to MATLAB, and other platforms.
Robert Fourer, Alternatives for Programming in an Algebraic Modeling Language 2
OR2014 Aachen —2-5 September 2014 —TA-21 Optimization Modeling II
Robert Fourer, Alternatives for Programming in an Algebraic Modeling Language 3
OR2014 Aachen —2-5 September 2014 —TA-21 Optimization Modeling II
Robert Fourer, Alternatives for Programming in an Algebraic Modeling Language 4
OR2014 Aachen —2-5 September 2014 —TA-21 Optimization Modeling II
Framework
3 ways to use a modeling language
Command language
Scripting language
Programming interface (API)
Example: Multicommodity transportation
Solution via command language
Sensitivity analysis via scripting
Example: Roll cutting
Pattern enumeration
via scripting / via API
Pattern generation
via scripting / via API
Robert Fourer, Alternatives for Programming in an Algebraic Modeling Language 5
OR2014 Aachen —2-5 September 2014 —TA-21 Optimization Modeling II
Command Language
Multicommodity transportation . . .
Products available at factories
Products needed at stores
Plan shipments at lowest cost
. . . with practical restrictions
Cost has fixed and variable parts
Shipments cannot be too small
Factories cannot serve too many stores
Robert Fourer, Alternatives for Programming in an Algebraic Modeling Language 6
OR2014 Aachen —2-5 September 2014 —TA-21 Optimization Modeling II
Multicommodity Transportation
Given
(cid:1841) Set of origins (factories)
(cid:1830) Set of destinations (stores)
(cid:1842) Set of products
and
(cid:1853) Amount available, for each (cid:1861) ∈ (cid:1841) and (cid:1868) ∈ (cid:1842)
(cid:3036)(cid:3043)
(cid:1854) Amount required, for each (cid:1862) ∈ (cid:1830) and (cid:1868) ∈ (cid:1842)
(cid:3037)(cid:3043)
(cid:1864) Limit on total shipments, for each (cid:1861) ∈ (cid:1841) and (cid:1862) ∈ (cid:1830)
(cid:1861)(cid:1862)
(cid:1855) Shipping cost per unit, for each (cid:1861) ∈ (cid:1841), (cid:1862) ∈ (cid:1830), (cid:1868) ∈ (cid:1842)
(cid:1861)(cid:1862)(cid:1868)
(cid:1856) Fixed cost for shipping any amount from (cid:1861) ∈ (cid:1841) to (cid:1862) ∈ (cid:1830)
(cid:1861)(cid:1862)
(cid:1871) Minimum total size of any shipment
(cid:1866) Maximum number of destinations served by any origin
Robert Fourer, Alternatives for Programming in an Algebraic Modeling Language 7
OR2014 Aachen —2-5 September 2014 —TA-21 Optimization Modeling II
Multicommodity Transportation
Mathematical Formulation
Determine
(cid:1850) Amount of each (cid:1868) ∈ (cid:1842) to be shipped from (cid:1861) ∈ (cid:1841) to (cid:1862) ∈ (cid:1830)
(cid:1861)(cid:1862)(cid:1868)
(cid:1851) 1 if any product is shipped from (cid:1861) ∈ (cid:1841) to (cid:1862) ∈ (cid:1830)
(cid:1861)(cid:1862)
0 otherwise
to minimize
∑ ∑ ∑ (cid:1855) (cid:1850) (cid:3397) ∑ ∑ (cid:1856) (cid:1851)
(cid:3036)∈(cid:3016) (cid:3037)∈(cid:3005) (cid:3043)∈(cid:3017) (cid:3036)(cid:3037)(cid:3043) (cid:3036)(cid:3037)(cid:3043) (cid:3036)∈(cid:3016) (cid:3037)∈(cid:3005) (cid:3036)(cid:3037) (cid:3036)(cid:3037)
Total variable cost plus total fixed cost
Robert Fourer, Alternatives for Programming in an Algebraic Modeling Language 8
OR2014 Aachen —2-5 September 2014 —TA-21 Optimization Modeling II
Multicommodity Transportation
Mathematical Formulation
Subject to
∑ (cid:1850) (cid:3409) (cid:1853) for all (cid:1861) ∈ (cid:1841), (cid:1868) ∈ (cid:1842)
(cid:3037)∈(cid:3005) (cid:3036)(cid:3037)(cid:3043) (cid:3036)(cid:3043)
Total shipments of product (cid:1868) out of origin (cid:1861)
must not exceed availability
∑ (cid:1850) (cid:3404) (cid:1854) for all (cid:1862) ∈ (cid:1830), (cid:1868) ∈ (cid:1842)
(cid:3036)∈(cid:3016) (cid:3036)(cid:3037)(cid:3043) (cid:3037)(cid:3043)
Total shipments of product (cid:1868) into destination (cid:1862)
must satisfy requirements
Robert Fourer, Alternatives for Programming in an Algebraic Modeling Language 9
OR2014 Aachen —2-5 September 2014 —TA-21 Optimization Modeling II
Multicommodity Transportation
Mathematical Formulation
Subject to
∑ (cid:1850) (cid:3409) (cid:1864) (cid:1851) for all (cid:1861) ∈ (cid:1841), (cid:1862) ∈ (cid:1830)
(cid:3043)∈(cid:3017) (cid:3036)(cid:3037)(cid:3043) (cid:3036)(cid:3037) (cid:3036)(cid:3037)
When there are shipments from origin (cid:1861) to destination (cid:1862),
the total may not exceed the limit, and (cid:1851) must be 1
(cid:3036)(cid:3037)
∑ (cid:1850) (cid:3410) (cid:1871)(cid:1851) for all (cid:1861) ∈ (cid:1841), (cid:1862) ∈ (cid:1830)
(cid:3043)∈(cid:3017) (cid:3036)(cid:3037)(cid:3043) (cid:3036)(cid:3037)
When there are shipments from origin (cid:1861) to destination (cid:1862),
the total amount of shipments must be at least (cid:1871)
∑ (cid:1851) (cid:3409) (cid:1866) for all (cid:1861) ∈ (cid:1841)
(cid:3037)∈(cid:3005) (cid:3036)(cid:3037)
Number of destinations served by origin (cid:1861)
must be as most (cid:1866)
Robert Fourer, Alternatives for Programming in an Algebraic Modeling Language 10
OR2014 Aachen —2-5 September 2014 —TA-21 Optimization Modeling II
Description:Sep 5, 2014 2. Alternatives for Programming in Conjunction with an Algebraic Modeling
Language for Optimization. Modeling languages for formulating.