Hi
For a simplified case, let's assume, I have following data:
id | cost | profit_in_case1 | profit_in_case2 |
A | -1 | 10 | 11 |
B | -0.6 | 10 | 5 |
C | -0.75 | 10 | 10.5 |
D | -0.75 | 10.5 | 10 |
And I have to maximize my profit with decisions,so if I just see the profits as individual rows, I'll have decisions like -
A - case2, B - case1, C - case2, D-case1.
But I have constraints like, I can only avail costs up to 1.5, so I can't choose A-case2 and B-case1 or A-case2 and C-case2(D-case1), instead I have to choose : C-case2 and D-case1. The final decision for maximum profit will look like:
decision_Cost | decision_profit_case1 | decision_profit_case2 |
1 | 0 | 0 |
1 | 0 | 0 |
0 | 0 | 1 |
0 | 1 | 0 |
This way, we have minimized cost (Total = 1.33) and maximized profit (Total = 21) in the constraints that we can chose only one of the decisions to be 1 and total cost doesn't breach the boundary of 1.5.
My original problem has other constraints as well, but if I can get a solution to this one in PROC IML or PROC OPTMODEL, I think I can build from there. Any help is deeply appreciated. I am using SAS 9.4.
PROC IML 's Genetic Algorithm can do it.
But better use SAS/OR , so post it at OR forum. @RobPratt is there.
PROC IML 's Genetic Algorithm can do it.
But better use SAS/OR , so post it at OR forum. @RobPratt is there.
Hi @Ksharp, can you please help me with the solution in PROC IML? We need a dynamic solution as no one is sure how many constraints, how many columns will be there. There may be many constraints added in each period and I want the code to be reuseable. Kindly suggest.
As far as I know, SAS/OR is the best choice . If you are using GA ,that would cost you lots of time. Doesn't @RobPratt answer your Q, or he is just in busy time .
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.