Reputation: 49
How to add this row in the main using incremental constrains to be run in next iteration model
forall ( i in beams)
beam_nomusedchannel [i] <= ceil (Nchannels/adjbeams[i]);
noting that i have defined it as
forall ( i in beams)
ctEmpty:0<=0;
noting that beam_nomusedchannel is a decision variable array in the model adjbeams is an after processing defined array (after subject to) in the model
Upvotes: 0
Views: 55
Reputation: 10059
range beams=0..10;
int adjbeams[i in beams]=i;
int NChannels=20;
dvar int beam_nomusedchannel[beams] in 0..100;
maximize sum(i in beams) beam_nomusedchannel[i];
subject to
{
forall ( i in beams)
ctEmpty:0<=0;
}
execute
{
writeln(beam_nomusedchannel);
}
main
{
thisOplModel.generate();
cplex.solve();
thisOplModel.postProcess();
for(i in thisOplModel.beams)
{
thisOplModel.ctEmpty[i].setCoef(thisOplModel.beam_nomusedchannel[i], 1);
thisOplModel.ctEmpty[i].UB=thisOplModel.NChannels/thisOplModel.adjbeams[i];
}
cplex.solve();
thisOplModel.postProcess();
}
gives
[100 100 100 100 100 100 100 100 100 100 100]
[100 20 10 6 5 4 3 2 2 2 2]
Upvotes: 1