[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] [Fwd: Problem with GLPK when trying to find value functi
Re: [Help-glpk] [Fwd: Problem with GLPK when trying to find value functions]
Thu, 26 Jul 2012 18:04:57 +0400
> I'm using GLPK to find value functions, it's a family of linear programs
> with right-hand side as parameter.
> For instance, I'm constructing 3D integer lattice and at each site
> (point) I need to find optimal solution using site coordinates as
> right-hand side (in this case it's 3D vector).
> I wrote a function that solves the linear program using GLPK. At first
> it crashed on the second call. I replaced glp_delete_prob() on
> gpl_erase_prob() and
> it worked well for [0;3]^3 lattice (and [0;3]^2 lattice). The problems
> began [0;4]^2 (2D) lattice. I have segmentation fault and it's unusual
> because in [0;3]^3 I'm solving more programs.
> OS : Linux Debian, i686; Compiler: GCC 4.7.1
> Test instances: 3D: 4 columns, 3 rows; 2D: 3 columns, 2 rows; all the
> entries (matrix, objective function coeff, right-hand side) are
> Clearly, the problems begin when I'm setting span of the lattice to 4
> (5, 6, etc.).
> If anybody has any idea how to fix this, please help me.
Not seeing your code it is difficult to say something. Make sure that
all parameters (especially arrays) passed to glpk api routines have
correct types and contents. Before passing the glp_prob object to
glp_simplex write its contents to a text file with glp_write_lp and
inspect that file with a text editor to make sure that the instance is
correctly built. Try to use glpsol, the glpk stand-alone solver, to
solve the instance written in the text file. Check your code
carefully--most probably it has a bug.
BTW, if you only need to obtain solutions, you might write your lp in
the MathProg modeling language and then use glpsol to solve it.