help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Argument with glpsol


From: glpk xypron
Subject: Re: [Help-glpk] Argument with glpsol
Date: Tue, 18 Jan 2011 17:47:28 +0100

Hello

> is there any way to give an int parameter with
> glpsol (in command prompt) and then use this as a param (or variable)
> in .mod-file?

I added the following example to
http://en.wikibooks.org/wiki/GLPK/Using_GLPSOL#Passing_values_via_the_command_line

Create a model file test.mod
param p;
printf "p = %f\n",p;
end;

Create a batch file test.bat

Windows
echo data;param p := $1;end; > test.dat
glpsol.exe -m test.mod -d test.dat

Linux
#!/bin/sh
echo data\;param p := $1\;end\; > test.dat
glpsol -m test.mod -d test.dat

For Linux only the shell script has to made execuatble.
chmod 755 test.bat

Execute the batch file
./test.bat 3.14159

Observe that you can specify multiple data files e.g.
glpsol -m test.mod -d 1.dat -d 2.dat -d 3.dat

Best regards

Xypron
-- 
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail



reply via email to

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