Originally posted by: SystemAdmin
[agus said:]
Hi,
I have a problem in stating the forall statement in my constraints.
Here is my model:
{string} Nodes = ...;
tuple link {
key int id;
string p1;
string p2;
}
{link} links = ...;
tuple flight {
key string ID;
string destination;
string origin;
string status;
int OBT;
int TTD;
int ETA;
}
{flight} Flights = ...;
tuple linkRelation {
flight f;
link l;
}
{linkRelation} linkRelations with f in Flights, l in links = ...;
dvar int+ y[Flights][Flights][Nodes] in 0..1;
subject to {
//Overtaking #16
forall (i, j in Flights: i.ID != j.ID, u, v in ???)
y[i][j][v] - y[i][j][u] == 0;
}
And here is my data file:
Nodes = {"a", "b", "c", "d"};
links = {<1, "a", "b">, <2, "b", "c">, <3, "c", "d">};
Flights = {
<", "c", "a", "dept", 1, 30, 0>,
<", "c", "b", "dept", 1, 10, 0>
};
linkRelations = {<",1>, <",2>, <",3>, <",2>, <",3>};
For constraint ââ¬ÅOvertaking #16ââ¬Â I would like ââ¬Åu and vââ¬Â to be the nodes in the common link between flight i and flight j, where u != v.
With my data file, the common link between flight ââ¬Åxââ¬Â and flight ââ¬Åyââ¬Â are:
link #2: nodes ââ¬Åbââ¬Â and ââ¬Åcââ¬Â --> v = ââ¬Åcââ¬Â and u = ââ¬Åbââ¬Â and
link #3: nodes ââ¬Åcââ¬Â and ââ¬Ådââ¬Â --> v = ââ¬Ådââ¬Â and u = ââ¬Åcââ¬Â
The constraints I would like generate from the constraint are the following:
Y[sub]xyc[/sub] - Y[sub]xyb[/sub] = 0
Y[sub]yxc[/sub] - Y[sub]yxb[/sub] = 0
Y[sub]xyd[/sub] - Y[sub]xyc[/sub] = 0
Y[sub]yxd[/sub] - Y[sub]yxc[/sub] = 0
How do I state the u and v in the forall statement so that I could generate the preceding constraints?
subject to {
//Overtaking #16
forall (i, j in Flights: i.ID != j.ID, u, v in ???)
y[i][j][v] - y[i][j][u] == 0;
}
Thank you
Agus
#DecisionOptimization#OPLusingCPLEXOptimizer