How to correct this incremental constrains in the main because the below code gives me an error of (scripting run time error not of type 'lloNumVar ' because the Nchannel/ adj.beams may be an integer and fraction number.
main
{
for(i in thisOplModel.beams)
{
thisOplModel.ctEmpty[i].setCoef(thisOplModel.beam_nomusedchannel[i],1);
thisOplModel.ctEmpty[i].setCoef(thisOplModel.Nchannels/thisOplModel.adj_beams[i],-1);
thisOplModel.ctEmpty[i].setBounds(0,10000000)
}
cplex.solve();
thisOplModel.postProcess();
subject to
{
forall ( i in beams)
ctEmpty:0<=0;
//beam_nomusedchannel [i] >= ceil (Nchannels/adjbeams[i]);
}
If adjbeams and Nchannels are not decision variables you should turn
thisOplModel.ctEmpty[i].setCoef(thisOplModel.Nchannels/thisOplModel.adj_beams[i],-1);
thisOplModel.ctEmpty[i].setBounds(0,10000000)
into
//thisOplModel.ctEmpty[i].setCoef(thisOplModel.Nchannels/thisOplModel.adj_beams[i],-1);
thisOplModel.ctEmpty[i].setBounds(thisOplModel.Nchannels/thisOplModel.adj_beams[i],10000000);
main
{
for(i in thisOplModel.beams)
{
thisOplModel.ctEmpty[i].setCoef(thisOplModel.beam_nomusedchannel[i],1);
thisOplModel.ctEmpty[i].setCoef(thisOplModel.Nchannels/thisOplModel.adj_beams[i],-1);
thisOplModel.ctEmpty[i].setBounds(0,10000000)
}
cplex.solve();
thisOplModel.postProcess();
int Nchannels =20; // Nchannels is an integer number
subject to
{
forall ( i in beams)
ctEmpty:0<=0;
//beam_nomusedchannel [i] >= ceil (Nchannels/adjbeams[i]);
}
Execute
{
//adjbeams[beams] is an after execute array; {11,15,7,6,5,4,3,1,12,...}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.