Optimization with minimums and maximums capacity sas
1. Target Company
O p t i m i z a t i o n P r o b l e m
SC0X-MIT
By/ Mostafa Ashour
MM-SCX Student
SAS MILP
Solution Steps
2. Target Company
Target Company is a metal forming company that offers several types of products. One of its
sections produce one product family that consists of three types of products (1) Pin, (2) lock and
(3) coil.
Each type requires a certain number of labor hours and certain amount of steel. The resources
required and profits generated by each type are shown in the table below:
PIN LOCK COIL
LABOR REQ'D 3 hours 5 hours 8 hours
STEEL REQ'D 2 bags 5 bags 8 bags
COST $2K $3K $4K
PRICE $3K $5K $7K
3. Target Company
For the month of January, Target Company has 325 tons of steel and 400 hours of labor available.
Solve this problem optimally so that Target Company profit for January is maximized.
• how many items of the Pin type should Target Company Produce in January?
• how many items of the Lock type should Target Company Produce in January?
• how many items of the Coil type should Target Company Produce in January?
• what is Target Company expected profit for January?
4. Write proc optmodel;
Create all your "assets";
Input all your data;
Establish your variables;
Define your objective function;
Establish your Constraints;
Wrap it up (Solve, print results and quit)
Steps of SAS
Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
Step 7
5. There are two methods to write code in SAS. Expanding and
Notation.
But in this Problem we will using Expanding method to write
the Code not Notation method So, we will start from Step 4 but
step 1 is primary step.
Remember : It is difficult and take more time if we used
expanding method to solve large problems or problems
containing big data or many decision variables.
Writing the code
6. Step 1 – write Proc Optmodel;
This Line call SAS engine to create procedure optimization model.
After each line in sas we must put semicolon [ ; ] it means syntax of this line is
done.
7. Step 2 – Establish your variables;
In this step we have three variable, number of products of each type.
We will call them as Xp, Xl, and Xc
syntax is var variable_name Variable_declaration (integer/binary) them ;
Variable declaration is must for MILP but in LP it is optional.
8. Step 3 – Define your objective function;
Write max for profit and min for cost them make sure it’s blue.
We can called it Z or Profit or total profit but SAS can’t assign space between words so
we write it as Total_Profit or Profit only.
Objective function must include all decision variable, here it is function in Profit of
each type multiply by their decision variables.
Profit = Price – cost FOR each type
9. Step 4 – Establish your Constraints;
We have to add constrain to ensure the availability of labor hours and steel
capacity.
con constrain_name: Required resources for each type <= available resoures
Another constrain we need to ensure the negativity: Each item must be >=0;
10. Step 5 – Wrap it up (Solve, print results and quit);
This is Final Step and here we ask to what do we need to know
optimal Profit, optimal quantity foe each type.
In this step, we can ask to determine binding constraints and their shadow price
values to be included with the results. ex.[ Print Laborconst.dual; ].
11. Solution summary
Ensure that there are no error in the code and if there is an
error we must fix it to get the results.
Now we have to press Run to start solving. Then establish the
results.
To get maximum Profit which will be 145 $, We have to Produce 75
of Pin type, 35 of Lock type and won’t produce any Coil types.
12. Target Company cont.
In February, According to sales department they realized that they should doesn’t produce more
than 40 units of any type and at least 10 units of any type to ensure diversity in March month.
you have decided to both add the new constraints - to ensure diversity and that no more than 40
units of any given type will be offered in the month.
For the month of March, Target Company has 340 tons of Steel and 360 hours of labor available.
PIN LOCK COIL
MIN REQ’D 10 10 10
MAX ALLOWED 40 40 40
13. According To The Optimal solution :
▪ how many units of the Pin type should Target Company offer in March?
▪ how many units of the Lock type should Target Company offer in March?
▪ how many units of the Coil type should Target Company offer in March?
▪ what is Target Company expected profit for March?
14. All we have to do here are change the amount of available resource and add new
constrains to Minimum and Maximum production.
We don’t need to negativity constrains here.
After running the code we will get the new optimal solution.
15. Target Company cont.
In April, The Creative Department of Target Company has figured out a way to add diversity to the
Products, so that Target Company won't get bored doing the same thing over and over, while giving
customers a sense of diversity in the offering. Based on this, the President of the company has
decided to scrap both the mandatory minimum and maximum in the number of Prodcts offered
during April. In other words, these two constraints won't apply any more.
The new acts, however, require renting a special piece of equipment for each type. Because of this,
there is now a fixed cost that Target Company has to pay if they decide to offer a given type of
package in a month. These fixed costs are: $10K a month for the equipment that is rented if any Pin
type are offered, $5K a month for the equipment that is rented if any Lock type are offered, and $1K
a month for the equipment that is rented if any Coil type are offered.
16. Target Company cont.
PIN LOCK COIL
FIXED COST $ 10 $ 5 $ 1
For the month of April, Target Company has 360 tone of steel and 500 hours of labor..
Solve this problem optimally so that Target Company ' profit for April is maximized, while
respecting all the constraints.
17. Adding fixed costs if a type is offered requires the addition of a binary variable.
Binary variable is multiplied by the fixed cost of a particular type. Then added on to the objective function.
It means If the type is used, then the binary constraint is one and the fixed cost is counted in the objective
function. If the type is not used, then the binary constrain is zero and the fixed cost is not counted in the
objective function
The available resources also have been changed.
Remember: Binary variable needs to linking constrain to make sure that it properly represents fixed costs.
18. Here I used 1000 as a big number to establish linking constrains
New optimal Profit here is 159 $.