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: Andrew Makhorin
Subject: Re: Adding if/then/else statement to GMPL
Date: Thu, 27 Aug 2020 12:25:23 +0300

On Thu, 2020-08-27 at 11:01 +0200, Domingo Alvarez Duarte wrote:
> Hello !
> 
> I just finished adding the parsing code to parse this dummy model:
> 
> https://github.com/mingodad/GLPK/blob/local-set-param/examples/cut2.mo
> d
> 
> On that branch I've added let/repeat/problem and relaxed the only one 
> solve requirement, only the parsing is done (although corner cases
> can 
> be missing).
> 
> Any comment/suggestion/help is welcome !
> 
> =====
> 
> ./glpsol --genonly  -m cut2.mod
>  >./glpsol --genonly  -m cut2.mod
> GLPSOL: GLPK LP/MIP Solver, v4.65
> Parameter(s) specified in the command line:
>   --genonly -m cut2.mod
> Reading model section from cut2.mod...
> Reading data section from cut2.mod...
> 135 lines were read
> Checking (line 14)...
> Generating Number...
> Generating Fill...
> Generating Reduced_Cost...
> Generating Width_Limit...
> Display statement at line 46
> problem Cutting_Opt: Cut, Number, Fill;
> problem Pattern_Gen: Use, Reduced_Cost, Width_Limit;
> problem Mix: Cut, Reduced_Cost;
> Display statement at line 58
> price[20] = 0.166667
> price[45] = 0.416667
> price[50] = 0.5
> price[55] = 0.5
> price[75] = 0.833333
> Model has been successfully generated
>  >Exit code: 0
> 
> =====
> 
> Cheer !
> 
> 

> repeat {
>    solve Cutting_Opt;
>    let {i in WIDTHS} price[i] := Fill[i].dual;
>    display price;
> 
>    solve Pattern_Gen;
>    if Reduced_Cost < -0.00001 then {
>       let nPAT := nPAT + 1;
>       let {i in WIDTHS} nbr[i,nPAT] := Use[i];
>       display Use;
>    }
>    else break;
> }

I don't think that the solve statement is executed more than once.
Internally the solve statement is not a real statement (like display),
i.e. it doesn't "call" a solver; it is just a marker that separates the
main part and the post-solving part of the model.



reply via email to

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