Re: Adding if/then/else statement to GMPL

2020-08-30 Thread Domingo Alvarez Duarte
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 Sent: Monday, August 24, 2020 10:34 AM To: Meketon, Marc ; Andrew Makhorin ; help-glpk@gnu.org Subject: Re: Adding if/t

Re: Adding if/then/else statement to GMPL

2020-08-29 Thread Andrew Makhorin
On Sat, 2020-08-29 at 15:29 +0200, Domingo Alvarez Duarte wrote: > 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

Re: Adding if/then/else statement to GMPL

2020-08-29 Thread Domingo Alvarez Duarte
://ampl.com/BOOK/EXAMPLES/EXAMPLES2/cut.dat -Original Message- From: Domingo Alvarez Duarte Sent: Monday, August 24, 2020 10:34 AM To: Meketon, Marc ; Andrew Makhorin ; help-glpk@gnu.org Subject: Re: Adding if/then/else statement to GMPL Hello Meketon ! Could you share your view of how

Re: Adding if/then/else statement to GMPL

2020-08-27 Thread Domingo Alvarez Duarte
Hello Andrew ! After replying to your last email I came with this possible solution to allow multiple solve statements in GMPL: https://github.com/mingodad/GLPK/commit/b80bcd86f1a78eba753e919a56fb9b976934b237 Cheers ! On 27/8/20 11:44, Domingo Alvarez Duarte wrote: Hello Andrew ! Thanks

Re: Adding if/then/else statement to GMPL

2020-08-27 Thread Domingo Alvarez Duarte
Hello Andrew ! Thanks for reply ! You are right in respect to the original implementation, one possible way to have multiple solve statements working is to pause the execution return a code that would tell the caller to generate the problem, solve it, postsolve and then continue the

Re: Adding if/then/else statement to GMPL

2020-08-27 Thread Domingo Alvarez Duarte
nu.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

Re: Adding if/then/else statement to GMPL

2020-08-25 Thread Heinrich Schuchardt
Am 25. August 2020 20:17:06 MESZ schrieb Domingo Alvarez Duarte : >Hello Heinrich ! > >Here is better example from examples/shikaku.mod: > Just another example where the existing if-then-else expression can be used to shorten the code. Anyway comparing a binary to =1 is not a good idea in

Re: Adding if/then/else statement to GMPL

2020-08-25 Thread Domingo Alvarez Duarte
Hello Heinrich ! Here is better example from examples/shikaku.mod: With if/then/else: = /* Output solution graphically */ printf "\nSolution:\n"; for { row in rows1 } {     for { col in cols1 } {     if (sum{(i,j,k,l,m,n) in B:     col >= l and col <= n and (row = k or row

Re: Adding if/then/else statement to GMPL

2020-08-24 Thread Andrew Makhorin
> Probably something like MPL (Math Programming > Language) developed by G.Dantzig in 70's is what you would like to > have; > see https://dl.acm.org/doi/10.1145/800184.810495 . > I've got a scanned copy of this Tech. Report (May 1968, 92 pages); so if someone is interested, I can post it via

Re: Adding if/then/else statement to GMPL

2020-08-24 Thread Meketon, Marc
Well said. Sent from my mobile On Aug 24, 2020, at 1:39 PM, Jeffrey Kantor wrote:  Respectfully, and I very much appreciate the careful design of GMPL and its utility for creating ‘beautiful’ models, I have to disagree. What is being proposed, I think, is not a general purpose programming

[Fwd: Re: Adding if/then/else statement to GMPL]

2020-08-24 Thread Andrew Makhorin
Forwarded Message From: Jeffrey Kantor To: Andrew Makhorin Cc: "Meketon, Marc" , Domingo Alvarez Duarte , help-glpk@gnu.org Subject: Re: Adding if/then/else statement to GMPL Date: Mon, 24 Aug 2020 12:38:42 -0500 > Respectfully, and I very much appreciate the c

Re: Adding if/then/else statement to GMPL

2020-08-24 Thread Andrew Makhorin
On Mon, 2020-08-24 at 14: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'

[Fwd: Re: Adding if/then/else statement to GMPL]

2020-08-24 Thread Andrew Makhorin
Forwarded Message From: Jeffrey Kantor To: "Meketon, Marc" Cc: Andrew Makhorin , Domingo Alvarez Duarte , help-glpk@gnu.org Subject: Re: Adding if/then/else statement to GMPL Date: Mon, 24 Aug 2020 09:54:33 -0500 > This would be another vote for extending GM

Re: Adding if/then/else statement to GMPL

2020-08-24 Thread Domingo Alvarez Duarte
Hello Heinrich ! That example was a silly one only to do a minimal check that the add if/then/else was working (properly?). My implementation doesn't seem to need much code and allow a bit better expressiveness to GMPL. Another example from examples/pentomino.mod: Before: for{i in

RE: Adding if/then/else statement to GMPL

2020-08-24 Thread Meketon, Marc
, 2020 10:34 AM To: Meketon, Marc ; Andrew Makhorin ; 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

Re: Adding if/then/else statement to GMPL

2020-08-24 Thread Heinrich Schuchardt
On 24.08.20 16:33, Domingo Alvarez Duarte wrote: > 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

Re: Adding if/then/else statement to GMPL

2020-08-24 Thread Domingo Alvarez Duarte
Makhorin Sent: Sunday, August 23, 2020 2:56 PM To: Domingo Alvarez Duarte ; 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

RE: Adding if/then/else statement to GMPL

2020-08-24 Thread Meketon, Marc
, August 23, 2020 2:56 PM To: Domingo Alvarez Duarte ; 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

Re: Adding if/then/else statement to GMPL

2020-08-23 Thread Andrew Makhorin
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/9d70a37b16bd377722eeb3880fcf86 > bb3b812118  > > > Again any comment/suggestion is welcome ! > > Cheers ! > > >

Re: Adding if/then/else statement to GMPL

2020-08-23 Thread Domingo Alvarez Duarte
Hello ! Also I've added the break/continue statements here https://github.com/mingodad/GLPK/commit/9d70a37b16bd377722eeb3880fcf86bb3b812118 Again any comment/suggestion is welcome ! Cheers !

Adding if/then/else statement to GMPL

2020-08-23 Thread Domingo Alvarez Duarte
Hello ! I just added the if/then/else statement to GMPL here https://github.com/mingodad/GLPK/commit/8984d5db70ce0cc91189911164f5448390026a4a and hope it could be added to a future release of GLPK/GMPL. Any comment/suggestion is welcome ! param p symbolic := "dad"; check length(p) ==