# \[AMPL 24594\] need to write a temporal constraint

**URL:** <https://discuss.ampl.com/t/ampl-24594-need-to-write-a-temporal-constraint/453>\
**Category:** Google Group Mirror\
**Created:** [March 25, 2023, 7:28pm UTC](https://discuss.ampl.com/t/ampl-24594-need-to-write-a-temporal-constraint/453 "2023-03-25T19:28:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohamed\_mady](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@mohamed\_mady](https://discuss.ampl.com/u/mohamed_mady)\
**Post date:** [March 25, 2023, 7:28pm UTC](https://discuss.ampl.com/t/ampl-24594-need-to-write-a-temporal-constraint/453/1 "2023-03-25T19:28:44Z")

</div>

Hi all,  
I have some troubling with the following problem:  
I have a set of aircraft and i need to construct intervals which contains the overlapped aircraft, such intervals are defined starting from an array like ad:=[9,9:30,10,11,14,15] where each adjacent pairs form an interval, and this interval is formed by two vectors, one of departure time and one of arrival time, so, we have:

set F:= flight1 flight2 flight3;  
param a{i in F}; # arrival time of the flights  
a{i in F}:=  
flight1 9  
flight2 10  
flight3 11;

param d{i in F}; # departure time of the flights  
a{i in F}:=  
flight1 9:30  
flight2 15  
flight3 14;

the first thing i need is to union the two array, meanig a and d, in a new vector, ad, such that the vector is ordered in ascending order.  
the second step is once i have the new array ad, i need to define intervals, like:  
I1 that has extreme time 9 and 9:30, I2 that has extreme time 9:30 and 10 and so on.  
Next step i need to make a condition such that if that condition is true that the i-th flight,Fi, need to be in the j-th interval, Ij.  
Once a have all interval i need only to keep intervals with more than one element.

thank you for the attention

---

<div class="post-metadata">

**Author:** ![AMPL\_Google\_Group](https://avatars.discourse-cdn.com/v4/letter/a/9dc877/32.png) [@AMPL\_Google\_Group](https://discuss.ampl.com/u/AMPL_Google_Group)\
**Post date:** [March 27, 2023, 5:28pm UTC](https://discuss.ampl.com/t/ampl-24594-need-to-write-a-temporal-constraint/453/2 "2023-03-27T17:28:18Z")

</div>

For some of the concepts you descripbe, it would be very helpful to have more explanation:  
need to make a condition
