Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  how to model for selecting only candidate nodes

    Posted 10/08/20 04:08 PM
    Edited by System Admin 01/20/23 04:20 PM
    Hi every one,

    I would like to minimize selecting locations (cities) to invest factories based on the fixed costs, the detail is following.

    n= A, B, C, D, E, F, H, K and M for locations
    v = 1...5 for vehicles that can travel on cities.
    dij is the distance from city i to city j.
    Cn is fixed costs for building a factory at location n.

    Although all locations need to considered for vehicles traveling, only some locations n' = (B, D, H, K) are candidates that can be selected to built factories due to practical conditions.

    Could you help me with how to model a constraint for only selecting candidate locations to be invested?
    and how to code this constraint in CPLEX?

    Best regards,

    Ken Nguyen

    ------------------------------
    Ken Nguyen
    ------------------------------
    #DecisionOptimization


  • 2.  RE: how to model for selecting only candidate nodes

    Posted 10/09/20 03:16 AM
    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
    ------------------------------



  • 3.  RE: how to model for selecting only candidate nodes

    Posted 10/09/20 03:47 AM
    Edited by System Admin 01/20/23 04:15 PM

    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
    ------------------------------



  • 4.  RE: how to model for selecting only candidate nodes

    Posted 10/09/20 04:00 AM
    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
    ------------------------------



  • 5.  RE: how to model for selecting only candidate nodes

    Posted 10/09/20 05:42 AM
    Hi ALEX,

    Thank you for the very interesting examples, but could you help me with different bit problem as described below?

    We have 8 cities:

    A      B       C        D           H       K         M

    In which the cities of A, C, E, M are no investment for factories, even there are vehicles passing through them for product services.

    For example, if vehicle 1 travels A - > B ->C, then B can be invested in a factory with a cost as Cn(2) = 2.
                          if vehicle 2 travels B ->C ->D->E, then B, D can be invested factories with costs as Cn(2) = 2 and Cn(4) = 4;

    And we have a budget constraint <= B, such as $3.

    So, how to model to select only cities, which can be B, D, H, and K for investment while we still consider all cities as vehicles needs for product services.

    Best regards,

    Ken Nguyen



               



    ------------------------------
    Ken Nguyen
    ------------------------------



  • 6.  RE: how to model for selecting only candidate nodes

    Posted 10/13/20 08:54 PM
    Hi ALEX,

    Please help me the above example.

    Best regards,
    Ken Nguyen

     


    ------------------------------
    Ken Nguyen
    ------------------------------



  • 7.  RE: how to model for selecting only candidate nodes

    Posted 10/19/20 09:27 PM
    Hi ALEX,

    Please help me the above example.

    Best regards,
    Ken Nguyen

    ------------------------------
    Ken Nguyen
    ------------------------------