[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Output to GMPL data file

From: Philippe Jugla
Subject: Output to GMPL data file
Date: Tue, 27 Jul 2021 18:06:53 +0000

Hello everyone,

I am looping with a .bat file to run N simulations with glpsol. 

At the end of each simulation, I would like to use the value of a variable which is calculated, as an input for the next simulation.

What I have written in my .mod file doesn't work because it does not overwrite my storage.dat file after each simulation...

in the .mod file :

TIME = 0..T-1;

param initial_storage;

var storage {t in TIME}; 

/* I want to output the final storage value as initial storage for next simulation*/ 

printf ‘data; param initial_storage := ‘ & storage[T-1].val & ‘ ;’ >> ‘storage.dat’ 

printf ‘end ;’ >> ‘storage.dat’ 

the .bat file :

for /l %%k in (1,N,1) do (
echo solving DAY %%k...
"%GUSEKPATH%\glpsol.exe" --cuts -m "model.mod" -d "storage.dat" -d "data_%%k.dat"

Is there a way of achieving this ?

Thank you very much,

Best regards,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]