Calcite | Level 5

## Extension to optimising travel distance using OPTMODEL

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.

1 ACCEPTED SOLUTION

Accepted Solutions
SAS Super FREQ

## Re: Extension to optimising travel distance using OPTMODEL

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;
``````
2 REPLIES 2
SAS Super FREQ

## Re: Extension to optimising travel distance using OPTMODEL

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

## Re: Extension to optimising travel distance using OPTMODEL

Thanks Rob. Much appreciated!

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