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!

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!

Register now

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