well you may model what you need.
For instance:
{string } n= {"A", "B","C","D","E", "H", "K" , "M"};
float Cn[n]=[1,2,3,4,5,6,7,8];
{string } nprime= { "B","D","H", "K"};
dvar boolean investlocation[nprime];
// is a depot serving a location in n ?
dvar boolean serve[nprime][n];
minimize sum(i in nprime) investlocation[i]*Cn[i];
subject to
{
// a depot can serve maximum 4 locations
forall(i in nprime) sum(j in n ) serve[i][j]<=4;
// all locations should be served by at least one depot
forall(i in n) sum(j in nprime) serve[j][i]>=1;
forall(i in n,j in nprime) serve[j][i]<=investlocation[j];
}
regards
------------------------------
ALEX FLEISCHER
------------------------------
Original Message:
Sent: Fri October 09, 2020 03:46 AM
From: Ken Nguyen
Subject: how to model for selecting only candidate nodes
Hi ALEX,
subject to
{
// we need at least 2 depots
sum(i in nprime) investlocation[i]>=2;
}
For this constraint, we need forall for all locations. Right?
That means following.
subject to
{
// we need at least 2 depots
forall (l = 1 in n)
sum(i in nprime) investlocation[i]>=2;
}
Ken Nguyen
------------------------------
Ken Nguyen
------------------------------
Original Message:
Sent: Fri October 09, 2020 03:15 AM
From: ALEX FLEISCHER
Subject: how to model for selecting only candidate nodes
Hi,
what would be good is to have decision variables only for the subset of possible locations:
In OPL you could start with
{string } n= {"A", "B","C","D","E", "H", "K" , "M"};
float Cn[n]=[1,2,3,4,5,6,7,8];
{string } nprime= { "B","D","H", "K"};
dvar boolean investlocation[nprime];
minimize sum(i in nprime) investlocation[i]*Cn[i];
subject to
{
// we need at least 2 depots
sum(i in nprime) investlocation[i]>=2;
}
regards
------------------------------
ALEX FLEISCHER