BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

Hi 

For a simplified case, let's assume, I have following data:

idcostprofit_in_case1profit_in_case2
A-11011
B-0.6105
C-0.751010.5
D-0.7510.510

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_Costdecision_profit_case1decision_profit_case2
100
100
001
010

 

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

PROC IML 's Genetic Algorithm can do it.

But better use SAS/OR , so post it at OR forum. @RobPratt is there.

View solution in original post

4 REPLIES 4
Ksharp
Super User

PROC IML 's Genetic Algorithm can do it.

But better use SAS/OR , so post it at OR forum. @RobPratt is there.

thepushkarsingh
Quartz | Level 8

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.

Ksharp
Super User

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 .

thepushkarsingh
Quartz | Level 8
Thanks @Ksharp, @RobPratt answered the question and the solution is great. Many thanks to both of you.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still 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!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1014 views
  • 2 likes
  • 2 in conversation