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;
I dont understand assignments c{O, D}. my idea is assign a data step of two columns to this variable.
c{O,D} appears to be a cost matrix showing the costs from each of the two origins to each of the two destinations.
x{O,D} looks like it will be the optimal number of items to ship from each O to each D, subject to the various specified constraints.
And here endeth my understanding of proc optmodel.
But (edited addition): what data set do you want? Input data for proc optmodel, or output results? I imagine proc optmodel has a number of syntax options that include specifying data sets for problem parameters or optimization results.
In the problem you presented, which I ran, it looks like it makes no sense to send any of the Pittsburgh supply to Boston.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.