Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Formulation of conditional constraint

    Posted 08/08/17 05:17 PM

    Originally posted by: lisaz


    Hello, 

    I have another question on one constraint of my model. Most probably, it's easy for to answer, but I just don't understand how to formulate it correctly. 

     

    I have the following constraint: 

    //Cons08: Departuring Flights to Ireland and Northern Ireland need to be assigned to gates: 2, 5, 16, 19, 20, 23, 25, 26, 27, 28 
    Cons08: forall(f in Flights) forall(g in {2,5,16,19,20,23,25,26,27,28})
    if ((Type[f]==0) && (Destination[f]>=1)) {
    assignment[f][g] ==1 ;}

     

    and I have another constraint which says:

    //Cons02: each flight is assigned to only one gate
    Cons02: forall(f in Flights) 
    sum (g in Gates) assignment[f][g] ==1; 

     

    I attached my mod. file.

    Whenever I run the model it doesn't find a solution and I think Constraint 8 and 2 are "contradicting" each other. Without constraint 8, a solution is found. 

    How can I properly formulate the "forall(g in {2,5,16,19,20,23,25,26,27,28})"? --> These numbers all belong to the set "Gates". The reasoning of Cons08 is that certain flights (e.g. to Ireland (--> indicated by "if...")) can only be assigned to the gates "2, 5, 16, 19,..." but not to other gates like "1,3,4,..." 

     

    Thank you so much for your help!!!

    Regards, Lisa 

     


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: Formulation of conditional constraint

    Posted 08/09/17 06:04 AM

    Originally posted by: Philippe_Refalo


    I think that you rather need to remove the possibility that these flight (to Ireland for instance) are assigned to the other gates (1,3,4 ..) by setting assignment[f][g] to 0 and not the reverse : you cannot assign any variable to  1 at this stage because you don't know what gate will be assigned to these special flights. It is the role of the solver engine to do this. 

    Regards,

    Philippe


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 3.  Re: Formulation of conditional constraint

    Posted 08/09/17 08:21 AM

    Originally posted by: lisaz


    Hello, 

    I tried to do so and reformulated my constraint into: 

    //Cons08: Departures to Ireland and Northern Ireland need to be assigned to gates:

    //1A, 1H, 12, 14, 15, 18, 20, 21, 22, 23
    Cons08: forall(f in Flights) forall(g in {1,3,4,6,7,8,9,10,11,12,13,14,15,17,18,21,22,24})
    if ((Type[f]==0) && (Destination[f]>=1)) {
    assignment[f][g] ==0 ;}

     

    However, I still have the same problem. The solver doesn't find a solution - without constraint 08 the problem gets solved. 

     

    And I don't try to assign my decision variable to 1, I just want to tell the solver that it can set "assignment == 1" only for one of the gates {2,5,16,...}. Isn't it similar to say "forall(g in Gates)" - except that "Gates" is not a range anymore. 

     

    Do you have another idea how to formulate this constraint?


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 4.  Re: Formulation of conditional constraint

    Posted 08/09/17 08:43 AM

    Originally posted by: lisaz


    Hello again, 

    I just tried the code again with a much smaller data set and it worked. Probably the reason why I don't get a solution needs to be searched in my data sheet. 

    Thanks very much for your help! 


    #DecisionOptimization
    #OPLusingCPOptimizer