I am solving a profit maximization model and I have that the set O is the set of all players, what I want is that this model is solved for each of the players that are in this set and at the end I get a matrix that has the result of the objective function of each player. With what you told me I made this change to the loop:
- I added to the .dat file:
set Oaux :=
O1
O2
O3
O4
O5
O6
O7
O8
O9
O10
O11
O12
O13
O14
O15
O16
O17
O18
O19
O20
O21
;
- I added to the .mod file:
set Oaux;
- And to the .run file I made this change:
option solver cplex;
param FLPCA{1..NJ} default 0;
for {i in 1..NJ}{
display Osub[i];
let O := Osub[i];
solve;
let FLPCA[i] := FCN;
display FLPCA;
let O := Oaux; #This right here.
}
However, now I get another error, which is as follows:
Error at _cmdno 13 executing "solve" command.
(file D:..Benef_D2.run, line 11, offset 509):
error processing param CT_oa:
23 invalid subscripts discarded:
CT_oa['O1','A1']
CT_oa['O1','A2']
CT_oa['O1','A3']
and 20 more.
Error at _cmdno 13 executing "solve" command
(file D:..Benef_D2.run, line 11, offset 509):
error processing param CT_oc:
4 invalid subscripts discarded:
CT_oc['O1','C1']
CT_oc['O1','C2']
CT_oc['O1','C3']
and 1 more.
Error at _cmdno 13 executing "solve" command
(file D:..Benef_D2.run, line 11, offset 509):
error processing param V_otp:
10 invalid subscripts discarded:
V_otp['O1','T1','P1']
V_otp['O1','T1','P2']
V_otp['O1','T1','P3']
and 7 more.
Error at _cmdno 13 executing "solve" command
(file D:..Benef_D2.run, line 11, offset 509):
error processing var Ship_oa:
no value for CT_oa['O2','A1']'
I identify that all the parameters that had a subindex of the set O appear as if they were empty, like this:
ampl: display CT_oa;
CT_oa; #empty
ampl: display CT_oc;
CT_oc; #empty
ampl: display V_otp;
V_otp; #empty
Do you have any idea how to fix this other error? Any help would be appreciated.
Greetings!