help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Parametric studies in GMPL?


From: Jeffrey Kantor
Subject: Re: [Help-glpk] Parametric studies in GMPL?
Date: Fri, 9 Jul 2010 15:48:34 -0400

Hi Marc,

Exactly.  I appreciate Xypron's suggestion, but would much prefer to embed the logic directly in GMPL.  Seems to me even an elementary ability to loop and introduce conditionals in the solution process would open a wide range of applications to GMPL/GLPK.  

Jeff

On Fri, Jul 9, 2010 at 3:43 PM, Meketon, Marc <address@hidden> wrote:
This reminds me that at the very top of my "wish" list for GLPK is a control language for GMPL.  Something to experiment with various decomposition methods, column generation, and so on.

-Marc

-----Original Message-----
From: help-glpk-bounces+marc.meketon=oliverwyman.com@gnu.org [mailto:help-glpk-bounces+marc.meketon=oliverwyman.com@gnu.org] On Behalf Of glpk xypron
Sent: Friday, July 09, 2010 3:37 PM
To: Jeffrey Kantor; address@hidden
Subject: Re: [Help-glpk] Parametric studies in GMPL?

Hello Jeffy,

you can use a shell script.

Here is a minimalistic example. Save the following as file test.awk

BEGIN {
modfile = "test.mod";
datfile = "test.dat";
system("rm " modfile);
printf ("Writing model file\n");
printf ("#model file\n") > modfile;
printf ("param iter;\n") > modfile;
printf ("solve;\n") > modfile;
printf ("display iter;\n") > modfile;
printf ("end;\n") > modfile;
close(modfile);
for (i = 1; i <= 10; i++) {
 system("rm " datfile);
 printf("\n\nIteration %i\n",i);
 printf ("Writing data file\n");
 printf("#data file %i\n", i) > datfile;
 printf("data;\n") > datfile;
 printf("param iter := %i;\n", i) > datfile;
 printf("end;\n") > datfile;
 close(datfile);
 system("glpsol -m " modfile " -d " datfile);
 }
exit;
}


Run the script with

awk -f test.awk

Windows users can find a binary for awk at
http://gnuwin32.sourceforge.net/packages/gawk.htm
For Windows replace "rm " by "del ".

Please, observe that glpsol allows multiple data files,
so you could have one with the changing parameter and another
with the rest of your model data.

Best regards

Xypron

-------- Original-Nachricht --------
> Datum: Fri, 9 Jul 2010 09:15:19 -0400
> Betreff: [Help-glpk] Parametric studies in GMPL?

> Hi --
>
> I'd like to be able to parametric studies in GMPL.  In other words, do a
> simple loop over a range of parameter values with the solve statement
> inside
> the loop.  To the best of my knowledge this is not currently possible, or
> is
> it?  If not, could this be a feature that could be incorporated into GMPL
> at
> some point?
>
> Jeff

--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

_______________________________________________
Help-glpk mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-glpk
----------------------------------------------------------------------------
This e-mail and any attachments may be confidential or legally privileged.  If you received this message in error or are not the intended recipient, you should destroy the e-mail message and any attachments or copies, and you are prohibited from retaining, distributing, disclosing or using any information contained herein.  Please inform us of the erroneous delivery by return e-mail.

Thank you for your cooperation.
----------------------------------------------------------------------------



reply via email to

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