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

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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