-------- Forwarded Message --------
From: mail386...@mailout.e4ward.com
To: bug-glpk@gnu.org
Cc: mail386...@mailout.e4ward.com
Subject: uncaught self reference in model's param line crashes glpsol
v4.55
Date: Sun, 05 Mar 2017 15:26:21 +0000

First off, I would like to thank you for sharing such a great tool with the 
rest of the world!
On to the bug report.

I have noticed that glpsol reproducibly crashes on a debian wheezy box
  $ glpsol --version | head -1
  GLPSOL: GLPK LP/MIP Solver, v4.55
if a model's param line contains a self reference.

While the following model is OK

    param A_symbolic{1..2, 1..2}, default -1;
    param A{i in 1..2, j in 1..2} := 
            (if A_symbolic[i,j]=1 then 1.2 else
            (if A_symbolic[i,j]=2 then 3.4 else
                A_symbolic[i,j] ));
    solve;              
    for {i in 1..2} { for {j in 1..2} {printf "%5.2f ",A[i,j];} printf "\n"; } 
    data;                                           
    # if A_symbolic[i,j] = 1 then  A[i,j] is 1.2
    # if A_symbolic[i,j] = 2 then  A[i,j] is 3.4
    #                        else  A[i,j] is A_symbolic[i,j] 
    param A_symbolic: 1 2  :=
                   1  0 1
                   2  2 0 ;
    end;
    

a self reference in the definition of the A parameter is not caught by
glpsol, which causes the program to crash with a segmentation violation error:

    
    param A_symbolic{1..2, 1..2}, default -1;
    param A{i in 1..2, j in 1..2} := 
            (if A_symbolic[i,j]=1 then 1.2 else
            (if A_symbolic[i,j]=2 then 3.4 else
                A[i,j] ));
    solve;              
    for {i in 1..2} { for {j in 1..2} {printf "%5.2f ",A[i,j];} printf "\n"; } 
    data;                                           
    # if A_symbolic[i,j] = 1 then  A[i,j] is 1.2
    # if A_symbolic[i,j] = 2 then  A[i,j] is 3.4
    #                        else  A[i,j] is A_symbolic[i,j] 
    param A_symbolic: 1 2  :=
                   1  0 1
                   2  2 0 ;
    end;


The only difference between the two models was:

$ diff  glpsol_*mod
5c5
<                 A[i,j] ));  
---
>                 A_symbolic[i,j] ));


Any ideas?






_______________________________________________
Bug-glpk mailing list
Bug-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-glpk

Reply via email to