Decision Optimization

 View Only
Expand all | Collapse all

integer division decision variable

Archive User

Archive UserMon June 16, 2014 07:18 PM

ALEX FLEISCHER

ALEX FLEISCHERTue June 17, 2014 02:27 AM

  • 1.  integer division decision variable

    Posted Mon June 16, 2014 07:18 PM

    Originally posted by: RobertH79


    Hi there!

     

     

    I have got a set of datetimes as follows:

    start = [ 27.00 35.00 59.00 36.00 30.00 36.00 43.00 67.00 ];

    finish = [ 30.00 38.00 62.00 44.00 34.00 40.00 47.00 71.00 ];

    These numbers represent three days planning period in hours.

    These values index some events.

    float start[i in Events] = ...;

    float finish[i in Events] = ...;

    I have a dvar int t_finish[i in Events];

    I have a user defined variable to set the desired finishing time for every day during the planning period.  Its given in a 24 hours format. Finally I would like to get the values that are below the user defined limit.

    So I think I should use integer division all the values on the above values:

    forall (i in Events) t_finish[i] - (t_finish[i] div 24)*24 <= UserValue;

    forall (i in Events) t_finish[i] - (t_finish[i] div 24)*24 >= 0;

    But I have got the next errors :

    CPLEX(default) cannot extract expression: forall (i in Events)  0  <= t_finish[i] + (t_finish[i] div 24)*(-24);

    CPLEX(default) cannot extract expression: t_finish[i] div 24.

    CPLEX(default) cannot extract model: IloAlgorithm cannot extract extractable.

     

    I think its because of the decision variable and the div.

    Does anybody can advise a solution to the definition.

     

    Thank you in advance.

    Robert

     

    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: integer division decision variable

    Posted Tue June 17, 2014 02:27 AM

    Hi,

    using CP Optimizer could be a way:

    .mod

    using CP;
     range Events=1..8;
     int UserValue=1;
     
      float start[i in Events] = ...;

    float finish[i in Events] = ...;

    dvar int t_finish[i in Events];

    subject to
    {

    forall (i in Events) t_finish[i] - (t_finish[i] div 24)*24 <= UserValue;

    forall (i in Events) t_finish[i] - (t_finish[i] div 24)*24 >= 0;
    }

    and .dat

    start = [ 27.00 35.00 59.00 36.00 30.00 36.00 43.00 67.00 ];

    finish = [ 30.00 38.00 62.00 44.00 34.00 40.00 47.00 71.00 ];

    regards

     

    Alex Fleischer


    #DecisionOptimization
    #OPLusingCPLEXOptimizer