help-glpk
[Top][All Lists]
Advanced

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

RE: [Help-glpk] loop for mathprog


From: Robert Fourer
Subject: RE: [Help-glpk] loop for mathprog
Date: Wed, 15 Nov 2006 12:17:49 -0600

Mike,

How would what you want differ from the ability to write a script such as the
one copied below?  It's a simple script for sensitivity analysis -- there are
much more complicated examples -- but it serves as an example of how a modeling
language's own syntax could serve well as a scripting language.  Conversion
between variable names and variable indices is not an issue here, because the
user writes everything in terms of the symbolic model.

I have some sympathy for Andrew's view (see the copied message below), but
maybe I see the tradeoff differently.  It's a tradeoff between having
essentially the same language serving for both model definitions and script
writing, and having a general-purpose programming language that works through
an API to handle models written in a modeling language.  I have encountered
optimization modelers on each side of this tradeoff.

Bob Fourer
address@hidden


model steelT.mod;
data steelT.dat;

option solution_precision 10;
option solver_msg 0;

set AVAIL3 default {};
param avail3_obj {AVAIL3};
param avail3_dual {AVAIL3};

let avail[3] := 0;
param previous_dual default Infinity;

repeat {
   let avail[3] := avail[3] + 1;
   solve;
   if Time[3].dual = previous_dual then continue;

   let AVAIL3 := AVAIL3 union {avail[3]};
   let avail3_obj[avail[3]] := Total_Profit;
   let avail3_dual[avail[3]] := Time[3].dual;
   if Time[3].dual = 0 then break;

   let previous_dual := Time[3].dual;
}
display avail3_obj, avail3_dual;


> -----Original Message-----
> From: address@hidden [mailto:help-glpk-
> address@hidden On Behalf Of Michael Hennebry
> Sent: Tuesday, November 14, 2006 1:10 PM
> To: Andrew Makhorin
> Cc: CADI Abdelahd; address@hidden; Meketon, Marc
> Subject: Re: [Help-glpk] loop for for mathprog
> 
> On Tue, 14 Nov 2006, Andrew Makhorin wrote:
> 
> > There is a dilemma, because I do not think that mixing modeling
> > and "programming" capabilities within model description (as in
> > AMPL) is a good idea; on the other hand I would like to keep
> > compatibility between GNU MathProg and AMPL. Probably, there must be
> > another level, something like a script, that allows performing all
> > operations needed for reoptimization and post-optimal processing.
> 
> In my optimization work, I almost always use the
> API of a solver instead of a modeling language.
> The reason is that I usually want to solve another
> problem related to the first and its solution.
> Absent a reliable mechanism for converting variable
> names to variable indices this can be difficult.
> Being able to do the following from within code would be a good thing:
> read a problem specified in a modeling language
> solve problem
> update problem
> solve problem
> rinse and repeat as necessary
> print solution in convenient form.
> 
> Being able to convert names to indices would facilitate
> the update problem and print solution steps.
> 
> It's been a release or two since I last used GLPK,
> so if it now has and documents the aforementioned mechanism,
> never mind.
> 
> --
> Mike   address@hidden
> "it stands to reason that they weren't always called the ancients."
>                                                       --  Daniel Jackson
> 
> 
> 
> _______________________________________________
> Help-glpk mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-glpk

Attachment: steelT.mod
Description: Binary data

Attachment: steelT.dat
Description: Binary data

Attachment: steelT.sa7
Description: Binary data


reply via email to

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