Network Models II
description
Transcript of Network Models II
Network Models II
Shortest Path Cross Docking
Enhance Modeling Skills Modeling with AMPL
15057 Spring 03 Vande Vate
The Shortest Path Model
Find the shortest path from Home to 5
15057 Spring 03 Vande Vate
Direction
Two-way street
One-way street
15057 Spring 03 Vande Vate
03ShortestPathModelxls
15057 Spring 03 Vande Vate
Challenge
Build a Solver model
15057 Spring 03 Vande Vate
A Solver Model
The Objective Minimize $U$21
The Variables $C$13$J$20
The Constraints
Only Travel on existing edges
Number From ndash Number To = Net Required
15057 Spring 03 Vande Vate
1048673 Number From -Number To = Net Required
Number of times - Number of =
we leave times we enter +1 at Home (we leave once)
-1 at Site 5 (we arrive once)
0 everywhere else
each time we arrive (if ever) we leave
15057 Spring 03 Vande Vate
Flow Conservation
Assignment Model Sum across each row = 1 Sum down each column = 1 Each variable appears in 2 constraints
Shortest Path Model Sum across a row -Sum down the column = 0 Trips out of a site -Trips into the site Each variable appears in constraints
Compare with Assignment Model
15057 Spring 03 Vande Vate
Each variable appears in at most two constraints At most one constraint as -the variable At most one constraint at + the variable
Assignment Sum across each row = 1 Sum down each column = 1
Shortest Path Sum across the a row -sum down the col =
Network Flow Problems
15057 Spring 03 Vande Vate
Bounds
Variables can also have bounds
eg in the Shortest Path Model
Number of times we use each variable Lower bound gt=0
Upper bound lt=1 if it is an edge 0 otherwise
15057 Spring 03 Vande Vate
If the bounds and RHS are integral the solution will be integral It the costs are integral the reduced costs and marginal values will be integral
Can be solved very quickly Limited demands on memory
Properties of Network Flows
15057 Spring 03 Vande Vate
Crossdocking
3 plants 1048673 2 distribution centers 2 customers Minimize shipping costs
15057 Spring 03 Vande Vate
A Network ModelMinimum Cost Network Flow Problem
Challenge
Build a Solver model
15057 Spring 03 Vande Vate
Objective Minimize $K$28 Variables $C$17$D$19 $C$23$D$24 Constraints
Do not exceed supply at the plants
Meet customer demand
Do not exceed shipping capacity
15057 Spring 03 Vande Vate
A Solver Model
Flow conservation at the DCs $C$28$D$28 = 0
Supply and Demand like Autopower 1048673 Flow conservation at DCs like Shortest Path
And
15057 Spring 03 Vande Vate
Lots of applications1048673 Simple Models1048673 Optimal Solutions Quickly1048673 Integral Data Integral Answers
Network Flows Good News
15057 Spring 03 Vande Vate
Underlying Assumptions Single Homogenous Product Linear Costs No conversions or losses
15057 Spring 03 Vande Vate
Network Flows Bad News
Homogenous Product
Must be able to interchange positions of product anywhere
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
The Shortest Path Model
Find the shortest path from Home to 5
15057 Spring 03 Vande Vate
Direction
Two-way street
One-way street
15057 Spring 03 Vande Vate
03ShortestPathModelxls
15057 Spring 03 Vande Vate
Challenge
Build a Solver model
15057 Spring 03 Vande Vate
A Solver Model
The Objective Minimize $U$21
The Variables $C$13$J$20
The Constraints
Only Travel on existing edges
Number From ndash Number To = Net Required
15057 Spring 03 Vande Vate
1048673 Number From -Number To = Net Required
Number of times - Number of =
we leave times we enter +1 at Home (we leave once)
-1 at Site 5 (we arrive once)
0 everywhere else
each time we arrive (if ever) we leave
15057 Spring 03 Vande Vate
Flow Conservation
Assignment Model Sum across each row = 1 Sum down each column = 1 Each variable appears in 2 constraints
Shortest Path Model Sum across a row -Sum down the column = 0 Trips out of a site -Trips into the site Each variable appears in constraints
Compare with Assignment Model
15057 Spring 03 Vande Vate
Each variable appears in at most two constraints At most one constraint as -the variable At most one constraint at + the variable
Assignment Sum across each row = 1 Sum down each column = 1
Shortest Path Sum across the a row -sum down the col =
Network Flow Problems
15057 Spring 03 Vande Vate
Bounds
Variables can also have bounds
eg in the Shortest Path Model
Number of times we use each variable Lower bound gt=0
Upper bound lt=1 if it is an edge 0 otherwise
15057 Spring 03 Vande Vate
If the bounds and RHS are integral the solution will be integral It the costs are integral the reduced costs and marginal values will be integral
Can be solved very quickly Limited demands on memory
Properties of Network Flows
15057 Spring 03 Vande Vate
Crossdocking
3 plants 1048673 2 distribution centers 2 customers Minimize shipping costs
15057 Spring 03 Vande Vate
A Network ModelMinimum Cost Network Flow Problem
Challenge
Build a Solver model
15057 Spring 03 Vande Vate
Objective Minimize $K$28 Variables $C$17$D$19 $C$23$D$24 Constraints
Do not exceed supply at the plants
Meet customer demand
Do not exceed shipping capacity
15057 Spring 03 Vande Vate
A Solver Model
Flow conservation at the DCs $C$28$D$28 = 0
Supply and Demand like Autopower 1048673 Flow conservation at DCs like Shortest Path
And
15057 Spring 03 Vande Vate
Lots of applications1048673 Simple Models1048673 Optimal Solutions Quickly1048673 Integral Data Integral Answers
Network Flows Good News
15057 Spring 03 Vande Vate
Underlying Assumptions Single Homogenous Product Linear Costs No conversions or losses
15057 Spring 03 Vande Vate
Network Flows Bad News
Homogenous Product
Must be able to interchange positions of product anywhere
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
Direction
Two-way street
One-way street
15057 Spring 03 Vande Vate
03ShortestPathModelxls
15057 Spring 03 Vande Vate
Challenge
Build a Solver model
15057 Spring 03 Vande Vate
A Solver Model
The Objective Minimize $U$21
The Variables $C$13$J$20
The Constraints
Only Travel on existing edges
Number From ndash Number To = Net Required
15057 Spring 03 Vande Vate
1048673 Number From -Number To = Net Required
Number of times - Number of =
we leave times we enter +1 at Home (we leave once)
-1 at Site 5 (we arrive once)
0 everywhere else
each time we arrive (if ever) we leave
15057 Spring 03 Vande Vate
Flow Conservation
Assignment Model Sum across each row = 1 Sum down each column = 1 Each variable appears in 2 constraints
Shortest Path Model Sum across a row -Sum down the column = 0 Trips out of a site -Trips into the site Each variable appears in constraints
Compare with Assignment Model
15057 Spring 03 Vande Vate
Each variable appears in at most two constraints At most one constraint as -the variable At most one constraint at + the variable
Assignment Sum across each row = 1 Sum down each column = 1
Shortest Path Sum across the a row -sum down the col =
Network Flow Problems
15057 Spring 03 Vande Vate
Bounds
Variables can also have bounds
eg in the Shortest Path Model
Number of times we use each variable Lower bound gt=0
Upper bound lt=1 if it is an edge 0 otherwise
15057 Spring 03 Vande Vate
If the bounds and RHS are integral the solution will be integral It the costs are integral the reduced costs and marginal values will be integral
Can be solved very quickly Limited demands on memory
Properties of Network Flows
15057 Spring 03 Vande Vate
Crossdocking
3 plants 1048673 2 distribution centers 2 customers Minimize shipping costs
15057 Spring 03 Vande Vate
A Network ModelMinimum Cost Network Flow Problem
Challenge
Build a Solver model
15057 Spring 03 Vande Vate
Objective Minimize $K$28 Variables $C$17$D$19 $C$23$D$24 Constraints
Do not exceed supply at the plants
Meet customer demand
Do not exceed shipping capacity
15057 Spring 03 Vande Vate
A Solver Model
Flow conservation at the DCs $C$28$D$28 = 0
Supply and Demand like Autopower 1048673 Flow conservation at DCs like Shortest Path
And
15057 Spring 03 Vande Vate
Lots of applications1048673 Simple Models1048673 Optimal Solutions Quickly1048673 Integral Data Integral Answers
Network Flows Good News
15057 Spring 03 Vande Vate
Underlying Assumptions Single Homogenous Product Linear Costs No conversions or losses
15057 Spring 03 Vande Vate
Network Flows Bad News
Homogenous Product
Must be able to interchange positions of product anywhere
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
03ShortestPathModelxls
15057 Spring 03 Vande Vate
Challenge
Build a Solver model
15057 Spring 03 Vande Vate
A Solver Model
The Objective Minimize $U$21
The Variables $C$13$J$20
The Constraints
Only Travel on existing edges
Number From ndash Number To = Net Required
15057 Spring 03 Vande Vate
1048673 Number From -Number To = Net Required
Number of times - Number of =
we leave times we enter +1 at Home (we leave once)
-1 at Site 5 (we arrive once)
0 everywhere else
each time we arrive (if ever) we leave
15057 Spring 03 Vande Vate
Flow Conservation
Assignment Model Sum across each row = 1 Sum down each column = 1 Each variable appears in 2 constraints
Shortest Path Model Sum across a row -Sum down the column = 0 Trips out of a site -Trips into the site Each variable appears in constraints
Compare with Assignment Model
15057 Spring 03 Vande Vate
Each variable appears in at most two constraints At most one constraint as -the variable At most one constraint at + the variable
Assignment Sum across each row = 1 Sum down each column = 1
Shortest Path Sum across the a row -sum down the col =
Network Flow Problems
15057 Spring 03 Vande Vate
Bounds
Variables can also have bounds
eg in the Shortest Path Model
Number of times we use each variable Lower bound gt=0
Upper bound lt=1 if it is an edge 0 otherwise
15057 Spring 03 Vande Vate
If the bounds and RHS are integral the solution will be integral It the costs are integral the reduced costs and marginal values will be integral
Can be solved very quickly Limited demands on memory
Properties of Network Flows
15057 Spring 03 Vande Vate
Crossdocking
3 plants 1048673 2 distribution centers 2 customers Minimize shipping costs
15057 Spring 03 Vande Vate
A Network ModelMinimum Cost Network Flow Problem
Challenge
Build a Solver model
15057 Spring 03 Vande Vate
Objective Minimize $K$28 Variables $C$17$D$19 $C$23$D$24 Constraints
Do not exceed supply at the plants
Meet customer demand
Do not exceed shipping capacity
15057 Spring 03 Vande Vate
A Solver Model
Flow conservation at the DCs $C$28$D$28 = 0
Supply and Demand like Autopower 1048673 Flow conservation at DCs like Shortest Path
And
15057 Spring 03 Vande Vate
Lots of applications1048673 Simple Models1048673 Optimal Solutions Quickly1048673 Integral Data Integral Answers
Network Flows Good News
15057 Spring 03 Vande Vate
Underlying Assumptions Single Homogenous Product Linear Costs No conversions or losses
15057 Spring 03 Vande Vate
Network Flows Bad News
Homogenous Product
Must be able to interchange positions of product anywhere
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
Challenge
Build a Solver model
15057 Spring 03 Vande Vate
A Solver Model
The Objective Minimize $U$21
The Variables $C$13$J$20
The Constraints
Only Travel on existing edges
Number From ndash Number To = Net Required
15057 Spring 03 Vande Vate
1048673 Number From -Number To = Net Required
Number of times - Number of =
we leave times we enter +1 at Home (we leave once)
-1 at Site 5 (we arrive once)
0 everywhere else
each time we arrive (if ever) we leave
15057 Spring 03 Vande Vate
Flow Conservation
Assignment Model Sum across each row = 1 Sum down each column = 1 Each variable appears in 2 constraints
Shortest Path Model Sum across a row -Sum down the column = 0 Trips out of a site -Trips into the site Each variable appears in constraints
Compare with Assignment Model
15057 Spring 03 Vande Vate
Each variable appears in at most two constraints At most one constraint as -the variable At most one constraint at + the variable
Assignment Sum across each row = 1 Sum down each column = 1
Shortest Path Sum across the a row -sum down the col =
Network Flow Problems
15057 Spring 03 Vande Vate
Bounds
Variables can also have bounds
eg in the Shortest Path Model
Number of times we use each variable Lower bound gt=0
Upper bound lt=1 if it is an edge 0 otherwise
15057 Spring 03 Vande Vate
If the bounds and RHS are integral the solution will be integral It the costs are integral the reduced costs and marginal values will be integral
Can be solved very quickly Limited demands on memory
Properties of Network Flows
15057 Spring 03 Vande Vate
Crossdocking
3 plants 1048673 2 distribution centers 2 customers Minimize shipping costs
15057 Spring 03 Vande Vate
A Network ModelMinimum Cost Network Flow Problem
Challenge
Build a Solver model
15057 Spring 03 Vande Vate
Objective Minimize $K$28 Variables $C$17$D$19 $C$23$D$24 Constraints
Do not exceed supply at the plants
Meet customer demand
Do not exceed shipping capacity
15057 Spring 03 Vande Vate
A Solver Model
Flow conservation at the DCs $C$28$D$28 = 0
Supply and Demand like Autopower 1048673 Flow conservation at DCs like Shortest Path
And
15057 Spring 03 Vande Vate
Lots of applications1048673 Simple Models1048673 Optimal Solutions Quickly1048673 Integral Data Integral Answers
Network Flows Good News
15057 Spring 03 Vande Vate
Underlying Assumptions Single Homogenous Product Linear Costs No conversions or losses
15057 Spring 03 Vande Vate
Network Flows Bad News
Homogenous Product
Must be able to interchange positions of product anywhere
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
A Solver Model
The Objective Minimize $U$21
The Variables $C$13$J$20
The Constraints
Only Travel on existing edges
Number From ndash Number To = Net Required
15057 Spring 03 Vande Vate
1048673 Number From -Number To = Net Required
Number of times - Number of =
we leave times we enter +1 at Home (we leave once)
-1 at Site 5 (we arrive once)
0 everywhere else
each time we arrive (if ever) we leave
15057 Spring 03 Vande Vate
Flow Conservation
Assignment Model Sum across each row = 1 Sum down each column = 1 Each variable appears in 2 constraints
Shortest Path Model Sum across a row -Sum down the column = 0 Trips out of a site -Trips into the site Each variable appears in constraints
Compare with Assignment Model
15057 Spring 03 Vande Vate
Each variable appears in at most two constraints At most one constraint as -the variable At most one constraint at + the variable
Assignment Sum across each row = 1 Sum down each column = 1
Shortest Path Sum across the a row -sum down the col =
Network Flow Problems
15057 Spring 03 Vande Vate
Bounds
Variables can also have bounds
eg in the Shortest Path Model
Number of times we use each variable Lower bound gt=0
Upper bound lt=1 if it is an edge 0 otherwise
15057 Spring 03 Vande Vate
If the bounds and RHS are integral the solution will be integral It the costs are integral the reduced costs and marginal values will be integral
Can be solved very quickly Limited demands on memory
Properties of Network Flows
15057 Spring 03 Vande Vate
Crossdocking
3 plants 1048673 2 distribution centers 2 customers Minimize shipping costs
15057 Spring 03 Vande Vate
A Network ModelMinimum Cost Network Flow Problem
Challenge
Build a Solver model
15057 Spring 03 Vande Vate
Objective Minimize $K$28 Variables $C$17$D$19 $C$23$D$24 Constraints
Do not exceed supply at the plants
Meet customer demand
Do not exceed shipping capacity
15057 Spring 03 Vande Vate
A Solver Model
Flow conservation at the DCs $C$28$D$28 = 0
Supply and Demand like Autopower 1048673 Flow conservation at DCs like Shortest Path
And
15057 Spring 03 Vande Vate
Lots of applications1048673 Simple Models1048673 Optimal Solutions Quickly1048673 Integral Data Integral Answers
Network Flows Good News
15057 Spring 03 Vande Vate
Underlying Assumptions Single Homogenous Product Linear Costs No conversions or losses
15057 Spring 03 Vande Vate
Network Flows Bad News
Homogenous Product
Must be able to interchange positions of product anywhere
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
1048673 Number From -Number To = Net Required
Number of times - Number of =
we leave times we enter +1 at Home (we leave once)
-1 at Site 5 (we arrive once)
0 everywhere else
each time we arrive (if ever) we leave
15057 Spring 03 Vande Vate
Flow Conservation
Assignment Model Sum across each row = 1 Sum down each column = 1 Each variable appears in 2 constraints
Shortest Path Model Sum across a row -Sum down the column = 0 Trips out of a site -Trips into the site Each variable appears in constraints
Compare with Assignment Model
15057 Spring 03 Vande Vate
Each variable appears in at most two constraints At most one constraint as -the variable At most one constraint at + the variable
Assignment Sum across each row = 1 Sum down each column = 1
Shortest Path Sum across the a row -sum down the col =
Network Flow Problems
15057 Spring 03 Vande Vate
Bounds
Variables can also have bounds
eg in the Shortest Path Model
Number of times we use each variable Lower bound gt=0
Upper bound lt=1 if it is an edge 0 otherwise
15057 Spring 03 Vande Vate
If the bounds and RHS are integral the solution will be integral It the costs are integral the reduced costs and marginal values will be integral
Can be solved very quickly Limited demands on memory
Properties of Network Flows
15057 Spring 03 Vande Vate
Crossdocking
3 plants 1048673 2 distribution centers 2 customers Minimize shipping costs
15057 Spring 03 Vande Vate
A Network ModelMinimum Cost Network Flow Problem
Challenge
Build a Solver model
15057 Spring 03 Vande Vate
Objective Minimize $K$28 Variables $C$17$D$19 $C$23$D$24 Constraints
Do not exceed supply at the plants
Meet customer demand
Do not exceed shipping capacity
15057 Spring 03 Vande Vate
A Solver Model
Flow conservation at the DCs $C$28$D$28 = 0
Supply and Demand like Autopower 1048673 Flow conservation at DCs like Shortest Path
And
15057 Spring 03 Vande Vate
Lots of applications1048673 Simple Models1048673 Optimal Solutions Quickly1048673 Integral Data Integral Answers
Network Flows Good News
15057 Spring 03 Vande Vate
Underlying Assumptions Single Homogenous Product Linear Costs No conversions or losses
15057 Spring 03 Vande Vate
Network Flows Bad News
Homogenous Product
Must be able to interchange positions of product anywhere
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
Assignment Model Sum across each row = 1 Sum down each column = 1 Each variable appears in 2 constraints
Shortest Path Model Sum across a row -Sum down the column = 0 Trips out of a site -Trips into the site Each variable appears in constraints
Compare with Assignment Model
15057 Spring 03 Vande Vate
Each variable appears in at most two constraints At most one constraint as -the variable At most one constraint at + the variable
Assignment Sum across each row = 1 Sum down each column = 1
Shortest Path Sum across the a row -sum down the col =
Network Flow Problems
15057 Spring 03 Vande Vate
Bounds
Variables can also have bounds
eg in the Shortest Path Model
Number of times we use each variable Lower bound gt=0
Upper bound lt=1 if it is an edge 0 otherwise
15057 Spring 03 Vande Vate
If the bounds and RHS are integral the solution will be integral It the costs are integral the reduced costs and marginal values will be integral
Can be solved very quickly Limited demands on memory
Properties of Network Flows
15057 Spring 03 Vande Vate
Crossdocking
3 plants 1048673 2 distribution centers 2 customers Minimize shipping costs
15057 Spring 03 Vande Vate
A Network ModelMinimum Cost Network Flow Problem
Challenge
Build a Solver model
15057 Spring 03 Vande Vate
Objective Minimize $K$28 Variables $C$17$D$19 $C$23$D$24 Constraints
Do not exceed supply at the plants
Meet customer demand
Do not exceed shipping capacity
15057 Spring 03 Vande Vate
A Solver Model
Flow conservation at the DCs $C$28$D$28 = 0
Supply and Demand like Autopower 1048673 Flow conservation at DCs like Shortest Path
And
15057 Spring 03 Vande Vate
Lots of applications1048673 Simple Models1048673 Optimal Solutions Quickly1048673 Integral Data Integral Answers
Network Flows Good News
15057 Spring 03 Vande Vate
Underlying Assumptions Single Homogenous Product Linear Costs No conversions or losses
15057 Spring 03 Vande Vate
Network Flows Bad News
Homogenous Product
Must be able to interchange positions of product anywhere
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
Each variable appears in at most two constraints At most one constraint as -the variable At most one constraint at + the variable
Assignment Sum across each row = 1 Sum down each column = 1
Shortest Path Sum across the a row -sum down the col =
Network Flow Problems
15057 Spring 03 Vande Vate
Bounds
Variables can also have bounds
eg in the Shortest Path Model
Number of times we use each variable Lower bound gt=0
Upper bound lt=1 if it is an edge 0 otherwise
15057 Spring 03 Vande Vate
If the bounds and RHS are integral the solution will be integral It the costs are integral the reduced costs and marginal values will be integral
Can be solved very quickly Limited demands on memory
Properties of Network Flows
15057 Spring 03 Vande Vate
Crossdocking
3 plants 1048673 2 distribution centers 2 customers Minimize shipping costs
15057 Spring 03 Vande Vate
A Network ModelMinimum Cost Network Flow Problem
Challenge
Build a Solver model
15057 Spring 03 Vande Vate
Objective Minimize $K$28 Variables $C$17$D$19 $C$23$D$24 Constraints
Do not exceed supply at the plants
Meet customer demand
Do not exceed shipping capacity
15057 Spring 03 Vande Vate
A Solver Model
Flow conservation at the DCs $C$28$D$28 = 0
Supply and Demand like Autopower 1048673 Flow conservation at DCs like Shortest Path
And
15057 Spring 03 Vande Vate
Lots of applications1048673 Simple Models1048673 Optimal Solutions Quickly1048673 Integral Data Integral Answers
Network Flows Good News
15057 Spring 03 Vande Vate
Underlying Assumptions Single Homogenous Product Linear Costs No conversions or losses
15057 Spring 03 Vande Vate
Network Flows Bad News
Homogenous Product
Must be able to interchange positions of product anywhere
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
Bounds
Variables can also have bounds
eg in the Shortest Path Model
Number of times we use each variable Lower bound gt=0
Upper bound lt=1 if it is an edge 0 otherwise
15057 Spring 03 Vande Vate
If the bounds and RHS are integral the solution will be integral It the costs are integral the reduced costs and marginal values will be integral
Can be solved very quickly Limited demands on memory
Properties of Network Flows
15057 Spring 03 Vande Vate
Crossdocking
3 plants 1048673 2 distribution centers 2 customers Minimize shipping costs
15057 Spring 03 Vande Vate
A Network ModelMinimum Cost Network Flow Problem
Challenge
Build a Solver model
15057 Spring 03 Vande Vate
Objective Minimize $K$28 Variables $C$17$D$19 $C$23$D$24 Constraints
Do not exceed supply at the plants
Meet customer demand
Do not exceed shipping capacity
15057 Spring 03 Vande Vate
A Solver Model
Flow conservation at the DCs $C$28$D$28 = 0
Supply and Demand like Autopower 1048673 Flow conservation at DCs like Shortest Path
And
15057 Spring 03 Vande Vate
Lots of applications1048673 Simple Models1048673 Optimal Solutions Quickly1048673 Integral Data Integral Answers
Network Flows Good News
15057 Spring 03 Vande Vate
Underlying Assumptions Single Homogenous Product Linear Costs No conversions or losses
15057 Spring 03 Vande Vate
Network Flows Bad News
Homogenous Product
Must be able to interchange positions of product anywhere
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
If the bounds and RHS are integral the solution will be integral It the costs are integral the reduced costs and marginal values will be integral
Can be solved very quickly Limited demands on memory
Properties of Network Flows
15057 Spring 03 Vande Vate
Crossdocking
3 plants 1048673 2 distribution centers 2 customers Minimize shipping costs
15057 Spring 03 Vande Vate
A Network ModelMinimum Cost Network Flow Problem
Challenge
Build a Solver model
15057 Spring 03 Vande Vate
Objective Minimize $K$28 Variables $C$17$D$19 $C$23$D$24 Constraints
Do not exceed supply at the plants
Meet customer demand
Do not exceed shipping capacity
15057 Spring 03 Vande Vate
A Solver Model
Flow conservation at the DCs $C$28$D$28 = 0
Supply and Demand like Autopower 1048673 Flow conservation at DCs like Shortest Path
And
15057 Spring 03 Vande Vate
Lots of applications1048673 Simple Models1048673 Optimal Solutions Quickly1048673 Integral Data Integral Answers
Network Flows Good News
15057 Spring 03 Vande Vate
Underlying Assumptions Single Homogenous Product Linear Costs No conversions or losses
15057 Spring 03 Vande Vate
Network Flows Bad News
Homogenous Product
Must be able to interchange positions of product anywhere
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
Crossdocking
3 plants 1048673 2 distribution centers 2 customers Minimize shipping costs
15057 Spring 03 Vande Vate
A Network ModelMinimum Cost Network Flow Problem
Challenge
Build a Solver model
15057 Spring 03 Vande Vate
Objective Minimize $K$28 Variables $C$17$D$19 $C$23$D$24 Constraints
Do not exceed supply at the plants
Meet customer demand
Do not exceed shipping capacity
15057 Spring 03 Vande Vate
A Solver Model
Flow conservation at the DCs $C$28$D$28 = 0
Supply and Demand like Autopower 1048673 Flow conservation at DCs like Shortest Path
And
15057 Spring 03 Vande Vate
Lots of applications1048673 Simple Models1048673 Optimal Solutions Quickly1048673 Integral Data Integral Answers
Network Flows Good News
15057 Spring 03 Vande Vate
Underlying Assumptions Single Homogenous Product Linear Costs No conversions or losses
15057 Spring 03 Vande Vate
Network Flows Bad News
Homogenous Product
Must be able to interchange positions of product anywhere
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
A Network ModelMinimum Cost Network Flow Problem
Challenge
Build a Solver model
15057 Spring 03 Vande Vate
Objective Minimize $K$28 Variables $C$17$D$19 $C$23$D$24 Constraints
Do not exceed supply at the plants
Meet customer demand
Do not exceed shipping capacity
15057 Spring 03 Vande Vate
A Solver Model
Flow conservation at the DCs $C$28$D$28 = 0
Supply and Demand like Autopower 1048673 Flow conservation at DCs like Shortest Path
And
15057 Spring 03 Vande Vate
Lots of applications1048673 Simple Models1048673 Optimal Solutions Quickly1048673 Integral Data Integral Answers
Network Flows Good News
15057 Spring 03 Vande Vate
Underlying Assumptions Single Homogenous Product Linear Costs No conversions or losses
15057 Spring 03 Vande Vate
Network Flows Bad News
Homogenous Product
Must be able to interchange positions of product anywhere
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
Challenge
Build a Solver model
15057 Spring 03 Vande Vate
Objective Minimize $K$28 Variables $C$17$D$19 $C$23$D$24 Constraints
Do not exceed supply at the plants
Meet customer demand
Do not exceed shipping capacity
15057 Spring 03 Vande Vate
A Solver Model
Flow conservation at the DCs $C$28$D$28 = 0
Supply and Demand like Autopower 1048673 Flow conservation at DCs like Shortest Path
And
15057 Spring 03 Vande Vate
Lots of applications1048673 Simple Models1048673 Optimal Solutions Quickly1048673 Integral Data Integral Answers
Network Flows Good News
15057 Spring 03 Vande Vate
Underlying Assumptions Single Homogenous Product Linear Costs No conversions or losses
15057 Spring 03 Vande Vate
Network Flows Bad News
Homogenous Product
Must be able to interchange positions of product anywhere
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
Objective Minimize $K$28 Variables $C$17$D$19 $C$23$D$24 Constraints
Do not exceed supply at the plants
Meet customer demand
Do not exceed shipping capacity
15057 Spring 03 Vande Vate
A Solver Model
Flow conservation at the DCs $C$28$D$28 = 0
Supply and Demand like Autopower 1048673 Flow conservation at DCs like Shortest Path
And
15057 Spring 03 Vande Vate
Lots of applications1048673 Simple Models1048673 Optimal Solutions Quickly1048673 Integral Data Integral Answers
Network Flows Good News
15057 Spring 03 Vande Vate
Underlying Assumptions Single Homogenous Product Linear Costs No conversions or losses
15057 Spring 03 Vande Vate
Network Flows Bad News
Homogenous Product
Must be able to interchange positions of product anywhere
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
Flow conservation at the DCs $C$28$D$28 = 0
Supply and Demand like Autopower 1048673 Flow conservation at DCs like Shortest Path
And
15057 Spring 03 Vande Vate
Lots of applications1048673 Simple Models1048673 Optimal Solutions Quickly1048673 Integral Data Integral Answers
Network Flows Good News
15057 Spring 03 Vande Vate
Underlying Assumptions Single Homogenous Product Linear Costs No conversions or losses
15057 Spring 03 Vande Vate
Network Flows Bad News
Homogenous Product
Must be able to interchange positions of product anywhere
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
Lots of applications1048673 Simple Models1048673 Optimal Solutions Quickly1048673 Integral Data Integral Answers
Network Flows Good News
15057 Spring 03 Vande Vate
Underlying Assumptions Single Homogenous Product Linear Costs No conversions or losses
15057 Spring 03 Vande Vate
Network Flows Bad News
Homogenous Product
Must be able to interchange positions of product anywhere
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
Underlying Assumptions Single Homogenous Product Linear Costs No conversions or losses
15057 Spring 03 Vande Vate
Network Flows Bad News
Homogenous Product
Must be able to interchange positions of product anywhere
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
Homogenous Product
Must be able to interchange positions of product anywhere
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
No Fixed Charges 1048673 No Volume Discounts 1048673 No Economies of Scale
Linear Costs
15057 Spring 03 Vande Vate
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
Network Flows Simple Formulation Flow Out (sum across a row) lt= Capacity Flow In (sum down a column) gt= Demand Flow In -Flow Out = Constant Limited by Homogenous Product Linear Costs etc
Integer Data give Integral Solutions
Summary
15057 Spring 03 Vande Vate
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
Problems with Excel Solver Integration of ldquoModelrdquo and Data Example Change the time horizon of our Inventory Model Excel is a limited database tool Algebraic Modeling Languages Separate the ldquoModelrdquo from the Data Keep the data in databases
Modeling with AMPL
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
How they work
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
Established in US 1048673 Very good book 1048673 Lower barrier to entry 1048673 Free ldquostudentrdquo version 1048673 Industrial strength tool
Why AMPL
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
Pseudo AMPL to discuss models In class In exams
Need to be precise about Whatrsquos a parameter variable hellip
Indexing relationships between variables data constraints Challenges and Project
Our Use of AMPL
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
AMPL is very detailed Expect 1 or 2 per team to master Rest to read and understand Brings out the real issues Practical implementation --you can oversee Data issues --the real challenge
Valuable tool
Is this necessaryvaluable
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
set ORIG1048673 set DEST1048673 param supply ORIG1048673 param demand DEST1048673 param cost ORIG DEST1048673 var Trans ORIG DEST gt= 0
The Transportation Model
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
minimize Total_Cost sumo in ORIG d in DEST cost[od]Trans[od] st Supply o in ORIG sumd in DEST Trans[od] lt= supply[o] st Demand d in DEST sumo in ORIG Trans[od] gt= demand[d]
Transportation Model
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
An Access Database called TransportationDatamdb Tables in the database Origins Supply information
Destinations Demand information
The Data
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
Cost Unit transportation costs
The Costs
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
AMPL reads the model and the data combines the two and produces (in human readable form) hellip
15057 Spring 03 Vande Vate
Produced by the command expand gtAMPLOutputtxt
AMPLrsquos Output
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
table OriginTable IN ODBC DPersonal15057TransportationDatamdbOriginsORIG lt-[Origin] supply~SupplyExplanation lsquotablersquo is a keyword that says we will read or write data lsquoOriginTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
Originsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Originsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Origin mean that this field in the database indexes the data eg 500 is the supply for Amsterdam
Explanation
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
ORIG lt-[Origin] says that the values of the field Origin will define the set ORIG of origins supply~Supply says that the values of the parameter supply should hold the values read from the field Supply in the database
read table OriginTable reads the data
Explanation Continued
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
table DestinationTable IN ODBC DPersonal15057TransportationDatamdbldquoDestinationsDEST lt-[Destination] demand~DemandExplanation lsquotablersquo is a keyword that says we will read or write data DestinationTablersquo is a name we made up No other AMPL model entity can have this name lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Data
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo
rdquoDestinationsrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Destinationsrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around Destination mean that this field in the database indexes the data eg 400 is the demand for Leipzig
Explanation
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
DEST lt-[Destination] says that the values of the field Destination will define the set DEST of destinations demand~Demand says that the values of the parameter demand should hold the values read from the field Demand in the database
Explanation Continued
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
table CostTable IN ODBCldquoDPersonal15057TransportationDatamdbldquoCost[origin destination] costExplanation lsquotablersquo is a keyword that says we will read or write data
lsquoCostTablersquo is a name we made up No other AMPL model entity can have this name
lsquoINrsquo is a key word that says we are reading data
ldquoODBCrdquo says we are using ODBC to read the data
Reading Cost
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
DPersonal15057TransportationDatamdbrdquo is the path to the database Alternatively you can create a DSN (data source name) for this file say TransportData and use the command ldquoDSN=TransportDatardquo rdquoCostrdquo is the name of the table in the database Alternatively we can use an SQL command like ldquoSQL=SELECT FROM Costrdquo
The is syntax What follows is the mapping of the data we read to AMPL objects that will hold it
The brackets [] around origin and destination mean that these two fields in the database index the data eg 120 is the unit transportation cost from Amsterdam to Leipzig
Explanation
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
We donrsquot have an lt-here because we are not defining the members of a set
We read the values of the field cost in the database into the parameter cost Note that since these two names are identical we donrsquot need the ~
read table CostTable reads the data
Explanation Continued
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
model d15057TransportationModelmod1048673 option solver cplex use cplex to solve1048673 solve1048673 display Trans
15057 Spring 03 Vande Vate
Running AMPL
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
table TransOutTable OUT ODBC DPersonal15057TransportationDatamdbldquoTransOutorigin in ORIG destination in DEST
Trans[origin destination] gt 0 -gt [origin destination] Trans[origindestination]~Trans write table TransOutTable
Explanation lsquotablersquo is a keyword that says we will read or write data
lsquoTransOutTablersquo is a name we made up No other AMPL model entity can have this name
Writing Output
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
lsquoOUTrsquo is a key word that says we are writing data ldquoODBCrdquo says we are using ODBC to write the data DPersonal15057TransportationDatamdbrdquo is the path to the database Or you can use ldquoDSN=helliprdquo TransOutrdquo is the name of the table to create AMPL drops and writes this table Any data currently in the table is lost is syntax It separates the description of the destination from the definition of the data and the mapping of the columns
Explanation
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
origin in ORIG destination in DEST Trans[origin destination] gt 0 defines the index set that will control the data to write out This says to only report on origin-destination pairs where we actually send a positive flow -gt is syntax It separates the indexing from the data definition and mapping to fields of the output table
[origin destination] indicates that the records of the output table are indexed by the origin-destination pairs AMPL will write a new record for each pair
Trans[origindestination]~Trans says to create a field called Trans in the table and to populate it with the values of the Trans variable
More Explanation
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-
15057 Spring 03 Vande Vate
write table TransOutTable actually writes the data 1048673 The output is
More details available at 1048673
httpwwwamplcomcmcswhatamplNEWtableshtml
Explanation Completed
- Slide 1
- Slide 2
- Slide 3
- Slide 4
- Slide 5
- Slide 6
- Slide 7
- Slide 8
- Slide 9
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Slide 14
- Slide 15
- Slide 16
- Slide 17
- Slide 18
- Slide 19
- Slide 20
- Slide 21
- Slide 22
- Slide 23
- Slide 24
- Slide 25
- Slide 26
- Slide 27
- Slide 28
- Slide 29
- Slide 30
- Slide 31
- Slide 32
- Slide 33
- Slide 34
- Slide 35
- Slide 36
- Slide 37
- Slide 38
- Slide 39
- Slide 40
- Slide 41
- Slide 42
- Slide 43
- Slide 44
- Slide 45
-