Search found 204 matches
Hi Here is a small example with uniformly distributed random date set i /r1*r3/, j /c1*c3/, iter /1*3/; parameter randval(i,j) Random values, randvalloop(iter, i,j) Store the random values; * Set uniform random values between 1 and 10 * and set the seed so we can reproduce the results $set seed 1234...
Hi You use the wrong index for investments: in your table, it is indexed by "SI", and in your model by "S-I". - You should force GAMS to check your table on errors like these by defining SAM over the set of all SAM elements. E.g.: set ac All SAM elements /a_min, apetroil, a_ael, ane c_min, ... and t...
Hi I only use the f loop because you use K(i,t) in an equation with the additional index f. i and t are on both sides of the assignment but f is missing on the right: loop(f, eq_net9("K", i,f,t) = K.L(i,t); ); If K was also defined over f, you don't have to use a loop to assign values and this would...
- 2 days ago
- Forum: Syntax
- Topic: Urgent HELP! , GDX output in a loop uses old variable values
- Replies: 1
- Views: 31
Hi You defined the variables over i, j and t, so if you solve the model for a smaller subset, the variables that are not part of the subset aren't changed and keep the values of the previous solve. If you add some lines where you initialize all the variable with EPS loop(... loop(... loop(.. x.L ( i...
just redefine the parameter as
and adjust the export command as follows:
Code: Select all
This will correct the order and you will have the output according to equations.
Code: Select all
execute 'gdxxrw results.gdx par=eq_net9 rng=eq_net9!a1 Rdim=3 Cdim=1
Hi Why use the put command to write to Excel. The best tool for doing this is gdxxrw: Net9(i,f,t)$(Ainc(i,f)=1) .. K(i,t) =e= sum(j$(Ainc(j,f)=-1),K(j,t)) + 2*((R(f)/Zbase)*(P_line(f,t)/Sbase) + (X(f)/Zbase)*(Q_line(f,t)/Sbase)); parameter eq_net9(*,i,f,t); loop(f, eq_net9("K", i,f,t) = K.L(i,t); eq...
Hi You should rewrite the set j from your model and treat the variables and parameters independent of j. Here an example: set j /1*2/; parameter p(j) Parameter defined over j, pj Scalar to be used in the loop to replace p; p(j) = ord(j); variable OBJ,X; equation objective, eq1; objective.. OBJ =E= x...
Hi Just remove the index from the objective and save the results in a parameter Set j/1*52/ obj.. z=e= L('1') other constraints.. ( some of them still runs for every j) parameter results(j,*); MODEL test_data /ALL/ ; loop(j, SOLVE test_data USING NLP MINIMIZING z; results(j,"Objective") = z.L; DISPL...