I am facing problem in writing constraints using IloRange. There are no compilation error but the code is not running.
In the code, ad_sales.u_j[j] is a variable, while demand[j] and lambda[j] are parameters. The syntax I have used for ILoRange is ilorange(env, lower bound, variable, upper bound).
I need to find duals of a set of constraint, which is why i switched to IloRange. If I use the following command instead of Ilorange the code is running fine.
for(IloInt j=0; j<data.n; j++)
model_ad.add(ad_sales.u_j[j] <= demand[j]*lambda[j]);
But following is not working:
IloRangeArray cons(env, data.n);
for(IloInt j=0; j<data.n; j++)
{
cons.add(IloRange(env, 0, ad_sales.u_j[j],demand[j]*lambda[j]));
//model_ad.add(cons[j]);
}
model_ad.add(cons);
Really appreciate the help.
Thank You