Originally posted by: SystemAdmin
> for(var pwh in thisOplModel.relPowerhouses )
> {
> pwh.minPower=pwh.minPower*1.01;
> }
> The collection "relPowerhouses" is immutable because it is referenced
> by another element.
What you see is part of the expected behavior. In your loop you are iterating over the elements of relPowerhouses, and thus this object is locked and immutable within the loop, leading to the error when you try to individually change the field value of each element.
You could instead use the following to achieve your objective:
for(var index=0;index<thisOplModel.relPowerhouses.size;index++){
var pwh = Opl.item(thisOplModel.relPowerhouses,index);
pwh.minPower = pwh.minPower*1.01;
}
#DecisionOptimization#OPLusingCPLEXOptimizer