User Tools

Site Tools


interfaces:an_example_which_demonstrates_the_use_of_the_merge_option_of_gdxxrw_to_add_solutions_to_a_spreadsheet

An example, which demonstrates the use of the merge option of gdxxrw to add solutions to a spreadsheet

$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;
   );
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 11:00 (external edit)