User Tools

Site Tools


interfaces:an_example_which_demonstrates_the_use_of_the_merge_option_of_gdxxrw_to_add_solutions_to_a_spreadsheet

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

interfaces:an_example_which_demonstrates_the_use_of_the_merge_option_of_gdxxrw_to_add_solutions_to_a_spreadsheet [2007/05/07 13:00] (current)
Line 1: Line 1:
 +====== An example, which demonstrates the use of the merge option of gdxxrw to add solutions to a spreadsheet ======
 +<​code>​
 +$ontext
 +Please find below a modified version of the trnsport model;
 +the last few lines illustrate:
 +1. Preparing the worksheet
 +2. Adding solutions using the merge option of gdxxrw
 +$offtext
 +$call '​gamslib 1'
 +$include trnsport.gms
  
 +set pv /pv1*pv3/;
 +parameter wrk(i, j, pv);
 +*prepare sheet with all zeroes for the full domain
 +wrk(i, j, pv)=eps;
 +execute_unload '​f.gdx',​ wrk;
 +execute '​gdxxrw.exe f.gdx epsout=0.0 par=wrk rng=a1';​
 +wrk(i, j, pv)=0.0;
 +
 +loop(pv,
 +   Solve transport using lp minimizing z ;
 +   ​wrk(i,​ j, pv) = x.l(i,j);
 +   ​execute_unload '​f.gdx',​ wrk;
 +   ​wrk(i,​ j, pv) = 0.0;
 +   ​execute '​gdxxrw.exe f.gdx par=wrk rng=a1 merge';​
 +* some change in the model data
 +   ​a('​seattle'​) = a('​seattle'​) - 20;
 +   ​a('​san-diego'​) = a('​san-diego'​) + 20;
 +   );
 +</​code>​
IMPRESSUM / LEGAL NOTICEPRIVACY POLICY interfaces/an_example_which_demonstrates_the_use_of_the_merge_option_of_gdxxrw_to_add_solutions_to_a_spreadsheet.txt ยท Last modified: 2007/05/07 13:00 (external edit)