Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

Forcing a IloNumVar variable to take a value from a enumerated list

  • 1.  Forcing a IloNumVar variable to take a value from a enumerated list

    Posted 05/10/15 06:19 PM

    Originally posted by: Washout


    Hi all,

     

    This is likely to be a silly / easy question, but here goes...

    I am writing a CPLEX model which solves for a single track railway train timetable and the key decision variables relate to the time that a train starts to traverse a section - C_up[u][j] (= the time that train â€‹u​ starts to traverse section â€‹j​). It is of type IloNumVar (for each train I create a numVarArray with bounds of 0 and the time in mins corresponding to the timetable period).

    The issue is that the time that the trains traverse the initial section corresponding to the first sections at either end of the railway should correspond to an existing train path time. For example, there may be a valid starting time for a train on it's first section at t = 10, t = 47 and t = 88 and it needs to choose one of these. I know how to use indicator variables to choose 1 out of ​K​ constraints when the constraints are inequalities but I am a little stumped how to force the initial start time for a train to be one out of a list of possible times.

    Can anyone point out the obvious for me?

     

    Cheers,

    Martin


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Forcing a IloNumVar variable to take a value from a enumerated list

    Posted 05/11/15 03:47 PM

    If the start time t is a variable (IloIntVar or IloNumVar), you can use binary variables (IloBoolVar) t_1, t_2, ... to pick the start time. So in your example you would add the constraints t = 10*t_1 + 47*t_2 + 88*t_3 and t_1 + t_2 + t_3 = 1 (or <= 1 if you want to leave open the possibility that this train never starts).


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Forcing a IloNumVar variable to take a value from a enumerated list

    Posted 05/11/15 08:41 PM

    Originally posted by: Washout


    Thankyou Paul - it seems so obvious now!

     

    Cheers,

    Martin


    #CPLEXOptimizers
    #DecisionOptimization