BookmarkSubscribeRSS Feed
Santha
Pyrite | Level 9

Here is my description of the problem:

I have origins and destinations. There are few box sizes by which I can ship stuff from my origin to destination. Lets say for example there are 10 box sizes. Not all lanes (origin-destination combo) can have all 10 box sizes available. one or two may have all the 10 sizes available, many of them may have 7 sizes. very few can have 1 or 2 sizes only. Each size has its dimensions in terms of weight and volume. Each box size has a cost attached to it. My objective is to find the optimal mix of boxes, by minimizing costs and also respecting the capacities (weight and volume) of each box sizes.

 

E.g if box size 1 volume is 10 cuft. box 2 is 15 cub ft. I have a load of like 22 cu. ft. The model should say I can use 1 of box 2 with 15 cu.ft stuffed in it and the remaining 7 cu.ft can be stuffed in 1 x box size 1, if that combo is cheap. Else whatever combo is cheap. 

 

Can you guide me in the direction to proceed?

 

3 REPLIES 3
Santha
Pyrite | Level 9

My initial approach is sthg like this: Let say B1, B2 are box sizes.

 

Min: (#of B1 * Rateof B1) + (#of B2 * Rateof B2) + ... (#of Bn * Rateof Bn)

subject to:

VolumeCapacityB1 <= whatever is the number

VolumeCapacityB2 <= whatever is the number

WeightCapacityB1 <= whatever is the number

WeightCapacityB2 <= whatever is the number

 

Defining Variables:

Arcs (Orig-dest combo)

Boxnames 

Availability of box sizes, a binary variable indexed over arcs.

pchristophel
SAS Employee

Hello Santha,

There might be more to the decision you want to optimize but for what you described so far you can solve one optimization problem for each "lane". As far as I understand the lanes don't share resources, or is the total number of boxes used from destinations or overall limited in some way?

If you can optimize each lane individually, the problem can be formulated as follows:

 

data box_data;
	input size cost;
   datalines;
10 3
15 7
25 10
50 15
75 20
100 25
150 30
200 40
300 50
500 100
;

proc optmodel;
	/* Set for the boxes, just uses the position in the input dataset. */
	set BOXES;
	/* Amount that has to fit into the boxes. */
	num demand = 23179;
	/* Read the input data from a dataset. */
	num size{BOXES};
	num cost{BOXES};
	read data box_data into BOXES=[_N_] size cost;

	/* If the number of boxes is limited, we could add an upper bound as well. */
	var UseBox{BOXES} >= 0 integer;

	/* Minimize the cost. */
	min MinCost = sum{b in BOXES} cost[b] * UseBox[b];

	/* The sum of the sizes of the used boxes has to exceed the demand. */
	con cover_demand: sum{b in Boxes} size[b] * UseBox[b] >= demand;

	/* This will use the mixed integer solver since there are integer variables. */
	solve;

	/* Print the solution and the data to verify. */
	print UseBox size cost;
quit;

Maybe this is a good starting point for you.

Santha
Pyrite | Level 9

Thanks a lot. the  optimization problem is for each lane. and i was exactly thinking the same. thanks a lot. I will get started and keep working on it.

thanks a ton for your reply

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 3 replies
  • 1173 views
  • 2 likes
  • 2 in conversation