Hi All, Thanks
I have an interval variable
{ dvar interval cvixitrcd in RouteCustData in rcd.starttime..rcd.endtime size rcd.unloadtime+rcd.paperworktime; }
RouteCustData is defined as
// A generate table has customer visiting sequence for a route
{
tuple RouteCust{
key int routeid;
key int custid;
int unloadtime;
int paperworktime;
int traveltime;
int starttime;
int endtime;
};
{RouteCust} RouteCustData = ...; }
The calculation for the above interval variable is
{
startOf(cvixitrcd) == endOf(cvixitprev(RouteCustData, rcd)) + rcd.traveltime + truckwaitingtimercd ; }
{
where dvar int+ truckwaitingtime RouteCustData; is a variable and my objective function is
// objective function
dexpr float objective = sum(rc in routecust)truckwaitingtimerc;
// minimize objective function
minimize objective;
}
Now i want the end and start time of my interval variable cvixit should be in between one of the time windows out of many
the input for that are
{
A generated table has all time windows of customer for a route
tuple RouteCustTimeWindows{
key int routeid;
key int custid;
key int timewindowid;
int starttime;
int endtime;
};
{RouteCustTimeWindows} RouteCustTimeWindowsData = ...;
}
I have created following constraint to achieve that
1. Select only one time window out of many
{
forall(rcd in routecust)
{
sum(rctw in RouteCustTimeWindowsData: rcd.routeid == rctw.routeid
&& rcd.custid == rctw.custid)OnlyoneTimerctw == 1;
}
}
2. limit the start and end of the interval variable by the start and end of the selected time window
{
forall(rcd in routecust)
{
sum(rctw in RouteCustTimeWindowsData: rcd.routeid == rctw.routeid
&& rcd.custid == rctw.custid)OnlyoneTimerctw*rctw.starttime <= startOf(cvixitrcd);
endOf(cvixitrcd) <= sum(rctw in RouteCustTimeWindowsData: rcd.routeid == rctw.routeid
&& rcd.custid == rctw.custid)OnlyoneTimerctw*rctw.endtime;
}
}
The procedure here i followed is completely similar to what we follow in MIP.
I want to know how can we convert these two constraint efficiently into CP , using key words of constraint programming.
Thanks
Arun Lila
Topic
NOTICE: developerWorks Community will be offline May 2930, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
This topic has been locked.
1 reply
Latest Post
 20130502T08:28:34Z by Petr Vilím
ACCEPTED ANSWER
Pinned topic Selecting one out of multiple options in IlogCP
20130308T09:50:34Z

Answered question
This question has been answered.
Unanswered question
This question has not been answered yet.

ACCEPTED ANSWER
Re: Selecting one out of multiple options in IlogCP
20130502T08:28:34Z in response to SystemAdminHello,
Have a look on forbidStart or maybe forbidExtent constraints. Constraint forbidStart forbids an interval variable to start within some predefined set of fixed intervals. And forbidExtent constraint forbids an interval to overlap with a predefined set of fixed intervals. In both cases, the set of forbidden interval is described using stepFunction.
Best, Petr