Originally posted by: SystemAdmin
If TrainData contains few values >0, you can perhaps try something like the following formulation.
The idea is to reduce the domain of the iterations.
(Please check my formulation is still equivalent to yours.)
{T3} smallPaths1 = {<r,i,j,ti,tj> | <r,i,j,ti,tj,-1> in Paths: tj>ti};
{T3} small00 = {<r,i,j,ti,tj> | <r,i,j,ti,tj> in smallPaths1: TrainData[r].headway>0};
{T3} small01 = {<r,i,j,ti,tj> | <r,i,j,ti,tj> in small00: TrainData[r].headway>1};
{T3} small02 = {<r,i,j,ti,tj> | <r,i,j,ti,tj,-1> in Paths: TrainData[r].headway>1};
{T3} smallPaths2 = {<r,i,j,ti,tj> | <r,i,j,ti,tj,1> in Paths: tj>ti};
{T3} small00 = {<r,i,j,ti,tj> | <r,i,j,ti,tj> in smallPaths2: TrainData[r].headway>0};
{T3} small11 = {<r,i,j,ti,tj> | <r,i,j,ti,tj> in small00: TrainData[r].headway>1};
{T3} small22 = {<r,i,j,ti,tj> | <r,i,j,ti,tj,1> in Paths: TrainData[r].headway>1};
T1 A1
BlockNet = [ <i,t> :
<card({r | <r,i,j,ti,tj> in smallPaths1: tj>t>=ti}),
card({r | <r,a,i,ta,ti> in small00: ti>t>=ta})+
card({r | <r,b,a,tb,ta> in small01, <r,a,i,ta,ti> in small02: ta>t>=tb})>
| <i,t> in BlockNet];
T1 A2
BlockNet = [ <i,t> :
<card({r | <r,i,j,ti,tj> in smallPaths2: tj>t>=ti}),
card({r | <r,a,i,ta,ti> in small00: ti>t>=ta})+
card({r | <r,b,a,tb,ta> in small11, <r,a,i,ta,ti> in small22: ta>t>=tb})>
| <i,t> in BlockNet];
#DecisionOptimization#OPLusingCPLEXOptimizer