Originally posted by: SystemAdmin
[ph mooraa said:]
Hi All,
I have following definitions of decision variables -
typedef IloArray<IloBoolVarArray> BoolVarMatrix;
typedef IloArray<BoolVarMatrix> BoolVar3Matrix;
BoolVar3Matrix sched(env1,4);
IloBoolVarArray t(env1,T);
how can I write logical statement which involve these decision variables? for example,
for(IloInt z=0;z<T;z++) {<br /> for(IloInt h=0;h<4;h++) {<br /> for(IloInt r=0;r<4;r++) {<br /> if(sched[h][r][z]==1 || t[z]==1) //line 100 (if any element of sched is 1, I want t[z] to be 1
t[z] = 1; //line 101
else //line 102
t[z]=0;
}
}
}
I get errors like -
100: error: could not convert `operator||(((const IloConstraint&)((const IloConstraint*)((IloConstraint*)(&operator==(((const IloNumExprArg&)((const IloNumExprArg*)((IloNumExprArg*)(+(+(+(&sched)->IloArray<X>::operator[] [with X = main()::BoolVarMatrix](h))->IloArray<X>::operator[] [with X = IloBoolVarArray](r))->IloBoolVarArray::operator[](z))))), 1.0e+0))))), ((const IloConstraint&)((const IloConstraint*)((IloConstraint*)(&operator==(((const IloNumExprArg&)((const IloNumExprArg*)((IloNumExprArg*)(+(&t)->IloBoolVarArray::operator[](z))))), 1.0e+0))))))' to `bool'
101: error: invalid conversion from `int' to `IloNumVarI*'
101: error: initializing argument 1 of `IloBoolVar::IloBoolVar(IloNumVarI*)'
I tried using IloExpr but it didn't work. Both sched and t arrays are decision variables.
Any help will be really useful.
Thanks, phm
#CPLEXOptimizers#DecisionOptimization