Comments and answers for "Constraint programming"
https://developer.ibm.com/answers/questions/452483/constraint-programming.html
The latest comments and answers for the question "Constraint programming"Answer by Francis@qmul
https://developer.ibm.com/answers/answers/453551/view.html
Thank you for your answer.
This is a space time network and you mention position in space but you don't mention the position in time. Aircraft might be in the same position but at different times, thus we are going to need an extra constraint. Picking your formulation:
if !cancelled[i]:
(posbefore[i]==Di) && (posafter[i]==Ai) // (Space constraint)
// where posbefore returns the arrival of the previous flight and, posafter returns the departure of the next flight;
//Time constraint to observe the transit time constraint
(timebefore[i] <=TDi - 30) && (posafter[i] <= TAi - 30)
else
posbefore[i]==posafter[i]
timebefore[i] <= timeafter [i] - 30Thu, 14 Jun 2018 18:51:47 GMTFrancis@qmulAnswer by PhilippeLaborie
https://developer.ibm.com/answers/answers/453511/view.html
I see two possible CP models for your problem: one using integer variables and one using interval variables. It is still not clear to me which one would be the most efficient.
I’ll focus on a model with integer variables like the one you partially showed. If you want to model flight cancelation, I think you will need one additional Boolean variable for each flight that is 0/1 depending on the cancelation of the flight. Let’s call it ‘canceled[i]’ if i is the index of the flight. I would also create two variables for each flight f: the position of the plane just before the flight ‘posbefore[i]’ and the position of the plane just after the flight ‘posafter[i]’.
Let’s suppose flight i flights from position Di (known) to position Ai (known), if the flight is not canceled, these positions are known, so you have something like:
!canceled[i] => ( (posbefore[i]==Di) && (posafter[i]==Ai) )
If the flight is canceled, the location of the plane does not change (but it is not necessarily at Di at the beginning because previous flights might have been canceled too). So we would just post that the position does not change:
canceled[i] => (posbefore[i]==posafter[i])
And the continuity constraint is just that posafter[i-1]==posbefore[i]Thu, 14 Jun 2018 15:23:46 GMTPhilippeLaborieComment by Francis@qmul on Francis@qmul's answer
https://developer.ibm.com/answers/comments/452721/view.html
Many thanks for your reply. In respect to your questions:
What is the optimization problem you want to solve?
Recover a disrupted flight schedule, while complying with the constraints between flights: transit time, continuity, and airport capacity;
What are the decision variables, the constraints, the objective function?
The decision variables are the delays that can be introduced for each flight;
The constraints are transit time between flights, continuity between flights, and airport capacity.
The objective function is Min(delays + cancelations)
For this case, it is possible to find a solution with a delay of 3 minutes for flight 2582 to comply with 30 minutes transit time.
However, if I had to cancel flight 2581 (for whatever reason), I would have to cancel also flight 2582 because of the continuity constraint. So my question is, how do I formulate cancellation of flights?
ThanksMon, 11 Jun 2018 18:25:35 GMTFrancis@qmulAnswer by PhilippeLaborie
https://developer.ibm.com/answers/answers/452697/view.html
Hello,
You only describe a part of your problem so it is difficult to understand what you want to do. What is the optimization problem you want to solve? What are the decision variables, the constraints, the objective function ?Mon, 11 Jun 2018 16:41:18 GMTPhilippeLaborie