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!
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.