Hi
a model with only one time window could be
using CP;
range rTrucks = 1 .. 10;
range rVisits = 1 .. 100;
tuple TW{ int v; int s; int e; }
TW tw[v in rVisits] = <v, v, 2 * v> ;
dvar interval visit[t in rTrucks, v in rVisits] optional in tw[v].s .. tw[v].e size 1;
constraints{
forall(t in rTrucks)
noOverlap( all(v in rVisits) visit[t, v]);
}
then you can extend it to multiple time windows for each visit
using CP;
range rTrucks = 1 .. 10;
range rVisits = 1 .. 100;
tuple TW{ int v; int s; int e; }
{TW} tws with v in rVisits = ...;//read all possible time windows
dvar interval visit[t in rTrucks, v in rVisits] optional size 1;
dvar interval twVisit[t in rTrucks, tw in tws] optional in tw.s .. tw.e size 1 ;
constraints{
forall(t in rTrucks)
noOverlap( all(v in rVisits) visit[t, v]);
forall(t in rTrucks, v in rVisits)
alternative(visit[t,v], all( <v,s,e> in tws) twVisit[t, <v,s,e>]);
}
------------------------------
David Gravot
------------------------------