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

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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