Reputation: 49
I am new to using CPLEX studio. I am using a student version and hence not allowed to log the issue with IBM Support.
I am using a cplex problem pasted below. The issue is the minedOnlyOnce constraint. This is supposed to mine a block only once, but it mines a block more than once.
{int} TimePeriods =...;
{int} Blocks =...;
float value[Blocks] = ...;
float oreTons[Blocks] = ...;
float wasteTons[Blocks] = ...;
float resourceMaxCap =...;
float processMinCap =...;
tuple blockType {
int id;
int x;
int y;
int z;
};
{blockType} BlocksType = ...;
{blockType} Ontop[j in BlocksType] =
{i | i in BlocksType: j.z == i.z +1 &&
((j.x == i.x-1 ) ||
(j.x == i.x+1 ) ||
(j.x == i.x ) ) &&
((j.y == i.y-1 ) ||
(j.y == i.y+1 ) ||
(j.y == i.y ) ) };
dvar boolean schedule[Blocks][TimePeriods];
maximize
sum( b in Blocks, t in TimePeriods) ( value[b] * schedule[b][t] * 1/(1+0.1)^t );
subject to{
forall(b in Blocks) {
minedOnlyOnce :
sum( t in TimePeriods) (schedule[b][t]) <= 1;
}
forall( i in BlocksType,t in TimePeriods) {
BlocksOnTop :
sum(j in Ontop[i])(t) * schedule[i.id][t]-sum(j in Ontop[i])sum(r in TimePeriods : r <= t)(schedule[j.id][r]) <=0 ;
}
forall(t in TimePeriods) {
resourceAvailable :
sum(b in Blocks) (schedule[b][t]*oreTons[b]+schedule[b][t]*wasteTons[b]) <= resourceMaxCap;
}
forall(t in TimePeriods) {
minProcessFeed :
sum(b in Blocks)(schedule[b][t]*oreTons[b]) >= processMinCap;
}
}
SheetConnection sheet("3D_27block_data.xlsx");
BlocksType from SheetRead(sheet,"Data!A2:D28");
Blocks from SheetRead(sheet,"Data!A2:A28");
TimePeriods from SheetRead(sheet,"Data!O2:O4");
value from SheetRead(sheet,"Data!H2:H28");
oreTons from SheetRead(sheet,"Data!F2:F28");
wasteTons from SheetRead(sheet,"Data!G2:G28");
resourceMaxCap from SheetRead(sheet,"Data!P2:P4");
processMinCap from SheetRead(sheet,"Data!Q2:Q4");
schedule to SheetWrite(sheet,"Data!I2:K28");
Upvotes: 0
Views: 263
Reputation: 10062
if the model is not feasible CPLEX can relax labeled constraints and give a relaxed solution.
If you turn
forall(b in Blocks) {
minedOnlyOnce :
sum( t in TimePeriods) (schedule[b][t]) <= 1;
}
into
forall(b in Blocks) {
//minedOnlyOnce :
sum( t in TimePeriods) (schedule[b][t]) <= 1;
}
then that constraint will be turn into a hard constraint (one that cannot be relaxed)
Upvotes: 0