Operations Research topics: SAS/OR,
SAS Optimization, and SAS Simulation Studio

Please help

Accepted Solution Solved
Reply
Contributor
Posts: 22
Accepted Solution

Please help

Hi all,

Am pretty new to SAS/OR and to start with, am just trying to solve a simple assignment problem. Three carriers (Carrier 1, Carrier 2, Carrier 3) and three lanes (Lane 1, Lane 2, Lane 3) with their rates. Simple formulation to minimize the cost such that one carrier is assigned one lane and vice-versa. My Data sets are as below. Something is wrong in my coede, not understand what should I do to make it work ?? Please guide !!

DATA

Carrier             Lane         RatePerMile         

Carrier 1Lane 111
Carrier 1Lane 214
Carrier 1Lane 36
Carrier 2Lane 18
Carrier 2Lane 210
Carrier 2Lane 311
Carrier 3Lane 19
Carrier 3Lane 212
Carrier 3Lane 37

DATA1

OneCarrier 1
TwoCarrier 2
ThreeCarrier 3

DATA2

OneLane 1
TwoLane 2
ThreeLane 3

I have introduced binary variable and my code as below-

proc optmodel;

  set <string, string> BIDS;

  number RatePerMile {BIDS} init 0;   /*parameters*/

  Read data Optimize.data

  into BIDS = [Carrier Lane]

  RatePerMile;

  set <string> CARRIERS;

  string CarrierName {CARRIERS};  /*parameters*/

  Read data Optimize.data1

  into CARRIERS = [CarrierID]

  CarrierName;

  set <string> LANES;

  string LaneName {LANES};  /*parameters*/

  Read data OPTIMIZE.DATA2

  into LANES = [LaneID]

  LaneName;

  /*decision variables */

  var Assigned_Truckloads{BIDS} binary;

  /*constraints */

/* 1.. One carrier to One Lane. */

  constraint CarrierToOneLane {ll in LANES}:

  sum{<i,j> in BIDSSmiley Sadj=ll)} Assigned_Truckloads[i,j] = 1;

/* 2.. One Lane to one carrier.*/

  constraint LaneToOneCarrier {ii in CARRIERS}:

  sum{<i,j> in BIDSSmiley Sadi=ii) } Assigned_Truckloads[i,j] = 1;

  /*objective function*/

  min Total_Cost =

  sum{<i,j> in BIDS}

  RatePerMile[i,j] * Assigned_Truckloads[i,j];

  solve;

  expand;

quit;


Accepted Solutions
Solution
‎05-14-2013 11:41 AM
Contributor
Posts: 22

Re: Please help

Hi Leo,

Thank a bunch for looking into my code. I figured out thatmy CARRIERS and LANES sets had different values (One, Two & Three), whereas the SUM statement was looping over rates data set DATA (Carrier1..Lane1....). Hence it was going infeasible. I took out that CarrierID column (One, Two, Three) and made CarrierName as actual "key index" column contianing actual index values.And it worked.

Sorry for confusion, long story short- I was not reading consisetent data and hence error.

Thanks for your time though,

-Mike


View solution in original post


All Replies
SAS Employee
Posts: 37

Re: Please help

Hi Mike,

Your code overall looks reasonable. One thing I would do is use a single dataset and derive the LANES and CARRIER sets from BIDS.

You should get more specific answers if you post your log file. Where exactly are you stuck?

Solution
‎05-14-2013 11:41 AM
Contributor
Posts: 22

Re: Please help

Hi Leo,

Thank a bunch for looking into my code. I figured out thatmy CARRIERS and LANES sets had different values (One, Two & Three), whereas the SUM statement was looping over rates data set DATA (Carrier1..Lane1....). Hence it was going infeasible. I took out that CarrierID column (One, Two, Three) and made CarrierName as actual "key index" column contianing actual index values.And it worked.

Sorry for confusion, long story short- I was not reading consisetent data and hence error.

Thanks for your time though,

-Mike


SAS Employee
Posts: 37

Re: Please help

No problem!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 333 views
  • 0 likes
  • 2 in conversation