help-glpk
[Top][All Lists]
Advanced

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

Re: Adding if/then/else statement to GMPL


From: Domingo Alvarez Duarte
Subject: Re: Adding if/then/else statement to GMPL
Date: Sat, 29 Aug 2020 15:29:26 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Hello !

With this commit I'm close for a proof of concept of GMPL with multi problem, multi solve, repeat and let statements.

The let needs work for the dependence hell when update a parameter.

The multi solve statements is implemented as calling a user provided callaback (see in examples/glpsol.c for a crude example).

https://github.com/mingodad/GLPK/commit/65655c05fc8e315b3e43b98a1f232466614a0b46

It compiles and run examples/cut2.mod on an infinite loop due to problems with propagation of updates with 'let' statement.

Ideally it should be compatible with existing models (not yet fully implemented/checked).

Any comment/suggestion/help is welcome !

Cheers !

On 24/8/20 17:02, Meketon, Marc wrote:
Since GMPL is a subset of AMPL, I would begin by looking at:
https://ampl.com/BOOK/CHAPTERS/16-script.pdf

As far as examples, the classic 'cutting stock' problem is a good one.  The 
AMPL site has two different iterative approaches:
https://ampl.com/BOOK/EXAMPLES/EXAMPLES2/cut.mod

https://ampl.com/BOOK/EXAMPLES/EXAMPLES2/cut.run

and

https://ampl.com/BOOK/EXAMPLES/EXAMPLES2/cut2.mod

https://ampl.com/BOOK/EXAMPLES/EXAMPLES2/cut2.run

and the data file is at:
https://ampl.com/BOOK/EXAMPLES/EXAMPLES2/cut.dat


-----Original Message-----
From: Domingo Alvarez Duarte <mingodad@gmail.com>
Sent: Monday, August 24, 2020 10:34 AM
To: Meketon, Marc <Marc.Meketon@oliverwyman.com>; Andrew Makhorin 
<mao@gnu.org>; help-glpk@gnu.org
Subject: Re: Adding if/then/else statement to GMPL

Hello Meketon !

Could you share your view of how it would be expressed (an ideal model
sample) ?

If you want to talk about it, maybe I'll be interested in implement it !

Can you share a collection of models data to be used as base for the 
test/implementation ?

Cheers !

On 24/8/20 16:00, Meketon, Marc wrote:
I've always felt that GMPL needed if-then-else, for-loops, 'let' statements and 
the ability to re-solve to be a true modeling language.  And Andrew has always 
disagreed.

Many of the models that I create ultimately are 'iterative' where I need to 
take the results of one model and use it to setup another model.  To me, that 
is also modeling.  GMPL doesn't have it.

So often, I use GMPL for an initial model - it is a wonderful language, and I 
find it faster to code than alternatives.  But then when I 'get it right' I 
have to re-code it in PYOMO or PULP or write directly to an 'lp' file within a 
Python or C# or other language script.

Having the ability to run, adjust variables, add/take away constraints, re-run 
would be extremely useful, and make GMPL more of a one-stop modeling language.

-----Original Message-----
From: Help-glpk
<help-glpk-bounces+marc.meketon=oliverwyman.com@gnu.org> On Behalf Of
Andrew Makhorin
Sent: Sunday, August 23, 2020 2:56 PM
To: Domingo Alvarez Duarte <mingodad@gmail.com>; help-glpk@gnu.org
Subject: Re: Adding if/then/else statement to GMPL

On Sun, 2020-08-23 at 15:36 +0200, Domingo Alvarez Duarte wrote:
Hello !

Also I've added the break/continue statements here
https://github.com/mingodad/GLPK/commit/9d70a37b16bd377722eeb3880fcf8
6
bb3b812118


Again any comment/suggestion is welcome !

Cheers !



Please note that GNU MathProg is a *modeling* language; it is not a 
general-purpose programming language. If you need to produce a non-trivial 
solution report (since all such-like statements are allowed only on the 
post-solving stage), it would be more practical to write the solution to a 
temporary file and then process it with a separate program.




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