[Top][All Lists]

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

RE: Output to GMPL data file

From: Philippe Jugla
Subject: RE: Output to GMPL data file
Date: Tue, 27 Jul 2021 21:33:58 +0000

Hi Heinrich,

Thanks for your help, it works just fine.
Just had a look at the language reference too for the printf statement.

Best regards


De : Heinrich Schuchardt <>
Envoyé : mardi 27 juillet 2021 20:32
À : <>; Philippe Jugla <>
Objet : Re: Output to GMPL data file
Am 27. Juli 2021 20:06:53 MESZ schrieb Philippe Jugla <>:
>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’

Use a single > here.

>> is used to append.

Have a look at print format strings too.

Best regards


>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]