I'm working through a problem I'm trying to solve using proc optmodel and I found an example (see page 12 "A Transportation Problem") from the SAS sample library on the optmodel procedure that is close to what I'm trying to do. I'm struggling to replace the hard-coded values in the red code below with values from datasets (costs, supply, and demand)
proc optmodel;
/* specify parameters */
set O={'Detroit','Pittsburgh'};
set D={'Boston','New York'};
number c{O,D}=[30 20
40 10];
number a{O}=[200 100];
number b{D}=[150 150];
/* model description */
var x{O,D} >= 0;
min total_cost = sum{i in O, j in D}c[i,j]*x[i,j];
constraint supply{i in O}: sum{j in D}x[i,j]=a[i];
constraint demand{j in D}: sum{i in O}x[i,j]=b[j];
/* solve and output */
solve;
print x;
Below is the "input" table given in the example:
I have seen other optmodel examples that read values from datasets, but the key for me is I need my output in this matrix format where I can get the optimum configurations by origination and destination.
@RobPratt I'm hoping you can help me, based on my many hours of google searches looks like you're an absolute GOAT on optmodel! 😁
... View more