EMIS 8373: Integer Programming Introduction to AMPL updated 10 January 2006
Starting AMPL
Entering the GT Railroad Problem
Solving the GT Railroad Problem
A General Transportation Model h e s t o f r i g n D d a u m b v l j q c p x m i n X 2 O ; j D c x s u b e t o · a 8 ¸ r
transport_model.txt set O; set D; param a {i in O}; param r {j in D}; param c {i in O, j in D}; var x {i in O, j in D} >= 0; minimize cost: sum {i in O, j in D} c[i,j] * x[i,j]; subject to supply {i in O}: sum {j in D} x[i,j] <= a[i]; subject to demand {j in D}: sum {i in O} x[i,j] >= r[j];
GT_data.txt set O := IE_Junction, Centerville, Wayover_City; set D := A_Station, Fine_Place, Goodville, Somewhere_Street; # supply param a := IE_Junction 4 Centerville 1 Wayover_City 2; # demand param r := A_Station 1 Fine_Place 1 Goodville 1 Somewhere_Street 1;
GT_data.txt param c : A_Station Fine_Place Goodville Somewhere_Street := IE_Junction 13 35 42 9 Centerville 6 61 18 30 Wayover_City 15 10 5 9 ;
Solving the Model with GT_data.txt
The expand Command
The expand Command
Editing the Data File
Edited GT_data.txt set O := IE_Junction, Centerville, Wayover_City; set D := A_Station, Fine_Place, Goodville, Somewhere_Street; # supply param a := IE_Junction 3 Centerville 3 Wayover_City 3; # demand param r := A_Station 2 Fine_Place 2 Goodville 2 Somewhere_Street 2;
Resolving the Model
New Optimal Solution
Display the Results to a File
Using AMPL Student Edition on Windows Download AMPL Student Edition Download model and data file from Blackboard transport_model.txt GT_data.txt Save the files in the amplcml directory created in step 1 Double click on the AMPL icon to start AMPL
Solving the Model
Solving the Model with CPLEX
Edit GT_data.txt with WordPad
Find New Solution and Save Results
Viewing the Results Quit AMPL Open results.txt with WordPad or Word