# Re: Primal Reductions Allowing Infeasible Solution?

Hi,

I think this is a bug in presolve.

Plus if you use CPO you also get infeasible:

using CP;

int nPreDays=13;
int nDaysThisPeriod=123;
range totalPeriod=-nPreDays..nDaysThisPeriod;
tuple tup_Pilot {
int id;
string name;
string sched;
}
{tup_Pilot} Pilots={<12345,"Capt Sully","CC">};

tuple tup_TrngEvent {
int id;
int start;
int duration;
}
{tup_TrngEvent} TrainingEvents={<12345,2,7>};

tuple tup_DefDay {
int id;
int dayNum;
int onOff;
}
{tup_DefDay} DefinedDays={
<12345,-13,0>,
<12345,-12,0>,
<12345,-11,0>,
<12345,-10,0>,
<12345,-9,0>,
<12345,-8,1>,
<12345,-7,1>,
<12345,-6,1>,
<12345,-5,1>,
<12345,-4,1>,
<12345,-3,1>,
<12345,-2,1>,
<12345,-1,0>,
<12345,0,0>
};

tuple tup_TourPairs {
string sched;
int daysOn;
int daysOff;
}
{tup_TourPairs} TourPairs={
<"CC",1,3>,
<"CC",2,3>,
<"CC",3,3>,
<"CC",4,3>,
<"CC",5,3>,
<"CC",6,3>,
<"CC",7,4>,
<"CC",8,5>
};

tuple tup_TourPairCrew {
tup_Pilot p;
int lenOn;
int lenOff;
}
{tup_TourPairCrew} CrewTours={
|
p in Pilots, tp in TourPairs: p.sched==tp.sched
};

dvar int+ X[CrewTours,totalPeriod] in 0..1;
dvar int+ Y[Pilots,totalPeriod] in 0..1;

maximize 1;

subject to {
//Removing this constraint results in an infeasible model
forall(p in Pilots){
ShortTours: (sum(d in totalPeriod, ct in CrewTours:
ct.p==p && ct.lenOn==1)
X[ct,d])==0;
}

forall(p in Pilots, d in totalPeriod){
OneTourType: sum(d2 in totalPeriod, ct in CrewTours:
ct.p==p && d2<=d<=d2+ct.lenOn+ct.lenOff-1)
X[ct,d2]<=1;
}

forall(tr in TrainingEvents, ct in CrewTours:
tr.id==ct.p.id && tr.duration==ct.lenOn)
trainingtour: X[ct,tr.start]==1;

forall(dd in DefinedDays) {
forall(p in Pilots, d in totalPeriod:
p.id==dd.id && d==dd.dayNum)
ct_dd: Y[p,d]==dd.onOff;
}

forall(p in Pilots, d in totalPeriod){
ct_workday: Y[p,d]==sum(d2 in totalPeriod, ct in CrewTours:
p==ct.p && d2<=d<=d2+ct.lenOn-1)
X[ct,d2];
}
} //End of subject to

regards