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

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

CustomersPostcodeSalesType
Riya11005198A
Raj11000745A
Sam11003272B
Sompa11000231B
Predy11000348B
David11000576C

 

Portfolio Manager table remains the same

PMPositionPM_PostcodeTerritory
AManager110007NorthDelhi
BAnalyst110051EastDelhi
CManager110032EastDelhi
DAnalyst110003NorthDelh

 

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.

1 ACCEPTED SOLUTION

Accepted Solutions
RobPratt
SAS Super FREQ

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;

View solution in original post

2 REPLIES 2
RobPratt
SAS Super FREQ

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;
Zereul
Calcite | Level 5

Thanks Rob. Much appreciated!

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

Discussion stats
  • 2 replies
  • 1036 views
  • 0 likes
  • 2 in conversation