Originally posted by: GGR
Hi Janish
If I understand correctly your needs, the operation must start around a date +-120 for a certain number of tag dates
The answer depends on the tags are known or must be fixed by the search.
If the tag dates are known:
The model tell the start dates of the interval are constrained to be in a set of time segment centered on the tag dates of of radius 120.
You must have a look to the Forbidden start concept in
https://www.ibm.com/support/knowledgecenter/SSSA5P_12.8.0/ilog.odms.cplex.help/refcppcplex/html/interval_variables.html#50
and OPL reference of forbidStart function
https://www.ibm.com/support/knowledgecenter/SSSA5P_12.8.0/ilog.odms.ide.help/OPL_Studio/opllang_quickref/topics/tlr_oplsch_forbidStart.html
Please refer to the OPL distributed example in sched_calendar.mod
If the tag are not known
The tags segment are interval variable the solver must fix: You must define a chain of interval variable of maximum length twice the radius. These interval variables are optional because the tags segment may not content a start of an operation.
int radius = ...;
int center[nbtags] = ...;
dvar interval tagit[i in 1..nbtags] optional in (center[i]-radius)...(center[i] + radius) size in 0..2*radius // the possible tags intervals
Then the operation must start in one of these tag intervals. That is an interval variable that is the start of an operation is an alternative of start interval in the tags:
dvar interval operations[nbopers] ...; // declaration of the operation
dvar interval startOpers[nbopers];
dvar interval tagsOpers[nbopers][nbtags] optional size 0;
subject to {
forall(o in 1..nbopers) {
startsAtstart(operations[o], startOpers[o]); // synchronization of the start date
alternative(startOpers[o], all (t in 1..nbtags) tagsOpers[o][t]); // choice of the tag time of an operation
}
forall(t in 1..nbtags)
span(tagit[t] , all (o in 1..nbopers) tagsOpers[o][t]); // fix the tag interval variables
}
Hope that helps
#ConstraintProgramming-General#DecisionOptimization