Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Having difficulties with element method

    Posted 07/25/16 08:48 AM

    Originally posted by: MohammadAbdollahi


    I'm having hard time regarding how to model a constraint. I'm trying to solve a transportation problem and one of the constraints is as follows:

    
    t[s[i]] >= t[i] + travelTime (i, s[i])
    
    

    which t is the time at which node i is visited and s is the successor variable of node i ( t and s are variables).

    I also have a travel time matrix :

    
    int time = travelTime(int origin, int destination) 
    
    

    which defines the travel time between pair of nodes. I have defined the constraint as below:

    
    for (int i : set){
      IloIntExpr expr = model.linearIntExpr();
      expr = model.sum(model.element(t, s[i]), model.prod(t[i], -1));
      IloIntExpr next = model.element(range(0, nbNodes), s[i]);
      model.addGe(expr, travelTime(i, next));
    }
    
    

    ***range function generates [0,1, ... ,nbNodes] and [size(s) = size(t) = nbNodes]

    now the problem is that next is returning IloIntExpr and I want it to be int to pass it to travelTime(int, int), and also IloIntExpr is not castable to int. What can be the possible solution for my problem. I really appreciate any help in this regard.


    #ConstraintProgramming-General
    #DecisionOptimization


  • 2.  Re: Having difficulties with element method