Hello,
I've got a similar problem to the one here
https://communities.sas.com/t5/Mathematical-Optimization/Optimize-Traveling-Distance/td-p/308817
However, say I have an additional column "Type" in my customer table
Customers | Postcode | Sales | Type |
Riya | 110051 | 98 | A |
Raj | 110007 | 45 | A |
Sam | 110032 | 72 | B |
Sompa | 110002 | 31 | B |
Predy | 110003 | 48 | B |
David | 110005 | 76 | C |
Portfolio Manager table remains the same
PM | Position | PM_Postcode | Territory |
A | Manager | 110007 | NorthDelhi |
B | Analyst | 110051 | EastDelhi |
C | Manager | 110032 | EastDelhi |
D | Analyst | 110003 | NorthDelh |
If I want to include an additional constraint - where a portfolio manager can only handle a maximum of (say) 2 customer types, how would I formulate this?
Thanks.
Here's one way (after declaring and reading type):
/* a portfolio manager can only handle a maximum of (say) 2 customer types */
set TYPES = setof {c in CUSTOMERS} type[c];
var AssignType {TYPES, PORTFOLIO_MANAGERS} binary;
con AssignTypeCon {<c,p> in CP_PAIRS}:
Assign[c,p] <= AssignType[type[c],p];
con AtMostTwoTypes {p in PORTFOLIO_MANAGERS}:
sum {t in TYPES} AssignType[t,p] <= 2;
Here's one way (after declaring and reading type):
/* a portfolio manager can only handle a maximum of (say) 2 customer types */
set TYPES = setof {c in CUSTOMERS} type[c];
var AssignType {TYPES, PORTFOLIO_MANAGERS} binary;
con AssignTypeCon {<c,p> in CP_PAIRS}:
Assign[c,p] <= AssignType[type[c],p];
con AtMostTwoTypes {p in PORTFOLIO_MANAGERS}:
sum {t in TYPES} AssignType[t,p] <= 2;
Thanks Rob. Much appreciated!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.