Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Solutions not satisfying some constraints

    Posted 06/27/17 04:45 AM

    Originally posted by: UYPJ_Ha-eun_Park


    Hello, I wanna solve a simple integer programming problem for scheduling and attached .mod and .dat files.

     

    The solution with objective 11,306 is found but some solutions don't satisfy specific constraint, ct2. 

    I wonder if CPLEX is considered an optimal solution even if it does not satisfy some constraints, or is there a problem with my coding?

     

    Really hope I can get some answer at this forum.


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Solutions not satisfying some constraints

    Posted 06/27/17 06:37 AM

    Hi,

    if you add

    assert forall (g in Group)
    forall (t in 1..NbTimeslot:t in (1..NbTimeslot-CycleTime[g][t]+1))
      ct2check:
        sum( a in Autoclave, cy in 1..CycleTime[g][t] )
            Compatibility[g][a] * Assign[g][a][t+cy-1] <= 1;    
     

    at the bottom of your model, you do not get any violation.

    Are you sure ct2 is not satisfied ?

    regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Solutions not satisfying some constraints

    Posted 06/27/17 10:47 PM

    Originally posted by: UYPJ_Ha-eun_Park


    Thanks much for your reply.

    I add the code at the bottom of my model as your instruction, but the same thing happened. 

     

    For example, Assign[8][1][322]=1, Assign[8][1][331]=1 and Assign[8][1][340]=1 are found as solutions. But they definitely don't satisfy ct2. To satisfy ct2, Assign[8][1][322]+Assign[8][1][323]+Assign[8][1][324]+.....+Assign[8][1][423]<=1 but it is 3 under the calculated solutions. 

     

    Regards,

    Ha-eun Park


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Solutions not satisfying some constraints

    Posted 06/28/17 02:46 AM

    Hi,

    the code you added was an assert to check that everything was fine.

    If you want to dig further you may add

    {int} T=  {t | t in 1..NbTimeslot:t in (1..NbTimeslot-CycleTime[8][t]+1)  };    
    {int} indexes[t in T]=  { t+cy-1 | cy in 1..CycleTime[8][t]};

    execute
    {
    indexes;
    }     

    at the end and you could then check that 322, 331 and 340 are not in the same indexes set.

    regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Solutions not satisfying some constraints

    Posted 06/29/17 08:33 PM

    Originally posted by: UYPJ_Ha-eun_Park


    Hi, thanks for your reply.

    I add below code at the end of my model.

    {int} T=  {t | t in 1..NbTimeslot};    
    {int} indexes[t in T]=  { t+cy-1 | cy in 1..CycleTime[8][t]};

    execute
    {
    indexes;
    }     

     

    When T is 322, 322,331 and 340 are in the same indexes set. So Assign[8][1][322]+Assign[8][1][323]+Assign[8][1][324]+.....+Assign[8][1][423]=3. Is that right? I'm still confused that  the solutions, Assign[8][1][322]=1, Assign[8][1][331]=1 and Assign[8][1][340]=1, don't satisfy ct2.

     

    Regards,

    Ha-eun Park


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Solutions not satisfying some constraints

    Posted 06/30/17 07:31 AM

    Right, but this t=322 is not taken into account.

    See if I add

    {int} s={t |t in 1..NbTimeslot:t in (1..NbTimeslot-CycleTime[8][t]+1)};
    assert 322 in s;

    then this assert is broken. So what you wrote does not prove that ct2 is wrong

    regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Solutions not satisfying some constraints

    Posted 07/03/17 12:02 PM

    Could it be that you are mixing up some indices? I added these dummy variables and constraints to your model:

    dvar float+ ct2sum[g in Group][t in 1..NbTimeslot];
    dvar float+ ct2sumCompat[g in Group][t in 1..NbTimeslot];
    forall (g in Group)
    forall (t in 1..NbTimeslot:t in (1..NbTimeslot-CycleTime[g][t]+1)) {
      set_ct2sum:
        ct2sum[g][t] == sum( a in Autoclave, cy in 1..CycleTime[g][t] )
            Assign[g][a][t+cy-1];
      set_ct2sumCompat:
          ct2sumCompat[g][t] == sum( a in Autoclave, cy in 1..CycleTime[g][t] )
            Compatibility[g][a] * Assign[g][a][t+cy-1];
    }

    and then printed the values of the variables after optimization. The ct2sum variables were always 0 or 1, as were the ct2sumCompat variables. Maybe your indexing does not work as expected? That is also what Alex suggested, apparently you think that 322 should be in the set but it is not.


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Solutions not satisfying some constraints

    Posted 07/10/17 01:26 AM

    Originally posted by: UYPJ_Ha-eun_Park


    Sorry for late reply. I neither solve the problem nor give up to solve it. Was trying to understand your comment and finding alternatives but failed.. 

    When I added below code at the end of my model, the result is attached.

     

    {int} T=  {t | t in 1..NbTimeslot:t in (1..NbTimeslot-CycleTime[8][t]+1)  };    
    {int} indexes[t in T]=  { t+cy-1 | cy in 1..CycleTime[8][t]};

    execute
    {
    indexes;
    }     

     

    Please see the last row. When T is 319, the indexes set includes from 319 to 356. So 322, 331 and 340 are included in same index set. Am I right? 


    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: Solutions not satisfying some constraints

    Posted 06/27/17 07:56 AM

    How do you check for violation? When I solve your model I get this solution quality:

    Incumbent solution:
    MILP objective                                 1.1306000000e+04
    MILP solution norm |x| (Total, Max)            6.40000e+01  1.00000e+00
    MILP solution error (Ax=b) (Total, Max)        9.24360e-14  1.14058e-15
    MILP x bound error (Total, Max)                1.93561e-11  9.04117e-13
    MILP x integrality error (Total, Max)          4.55951e-11  1.15596e-12
    MILP slack bound error (Total, Max)            5.75906e-11  9.38361e-13

    You can see a solution error of 1e-14, but that is essentially zero. This error is only due to numerics.


    #CPLEXOptimizers
    #DecisionOptimization