BookmarkSubscribeRSS Feed
ericvalos
Calcite | Level 5

http://support.sas.com/documentation/cdl/en/ormpug/66851/HTML/default/viewer.htm#ormpug_optmodel_get...

 

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. 

1 REPLY 1
mkeintz
PROC Star

  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.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

SAS Innovate 2025: Call for Content

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!

Submit your idea!

Multiple Linear Regression in SAS

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.

Discussion stats
  • 1 reply
  • 924 views
  • 0 likes
  • 2 in conversation