Hi everyone
I want to solve a gams code in matlab and get the cost function, the objective function for each update of some parameters and set. I wrote the gams code which works perfectly. I created in gams the gdx file with the parameters and set that I want to update in matlab.
here is the coding
$set matout "‘gams_matlab.gdx’ cost.l, R_m, R_p, Q_m, Q_p, t " where t is the set, R_m, R_p, Q_m, Q_p the parameters and cost the variables.
In matlab, I create the structures for the parameters and set and use wgdx command to write these parameters and set such they can be updated in gams. the structure are well created in matlab.
here is the coding
Q_m = struct(‘name’,‘Q_m’,‘val’, [4]);
Q_p = struct(‘name’,‘Q_p’,‘val’,[0]);
R_m = struct(‘name’,‘R_m’,‘val’,[4]);
R_p = struct(‘name’,‘R_p’,‘val’,[0]);
t = struct(‘name’,‘t’,‘val’,‘s1’);
But unfortunately, running the wgdx(‘gams_matlab.gdx’, Q_m, Q_p, R_m, R_p, t); I am getting error: Error using wgdx
Non-positive coordinates are not allowed in index columns of sparse data
here is the rest of the coding
cost = gams(‘myopic_gams_matlab.gms LP=cplex’, t, Q_m, Q_p, R_m, R_p);
reward = cost.val;
please help me. the txt file is the matlab code
data_opt_lookup_inc.xlsx (2 MB)
gams_matlab.txt (672 Bytes)
myopic_gams_matlab.gms (11.5 KB)