help-glpk
[Top][All Lists]
Advanced

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

[Help-glpk] Re: Problem


From: Thierry Colomb
Subject: [Help-glpk] Re: Problem
Date: Thu, 18 Dec 2003 22:10:37 +0100
User-agent: Opera7.23/Win32 M2 build 3227

Many thanks for this quick response

What I do is:
- create the Problem and solve it with lpx_simplex + lpx_integer
- destroy the problem object using lib_free_env
- call lpx_create_prob to re-create the Problem and solve it again

lpx_create_prob LPX1                    ' Create 1rst pb
.... fill rows and columns
lpx_reset_parms LPX1                    ' Just in case
lpx_write_lpt LPX1, "Prob1"           ' Write problem to file Prob1
lpx_simplex LPX1                                ' Launch simplex
lpx_print_sol LPX1, "Sol1"            ' Write Solution to file Sol1
lpx_integer LPX1                                ' Launch MIP driver
lpx_delete_prob LPX1                    ' Delete pb
lpx_create_prob LPX2                    ' Create new pb
.... fill rows and columns      
lpx_reset_parms LPX1                    ' Just in case
lpx_write_lpt LPX2, "Prob2"           ' Write problem to file Prob2
lpx_simplex LPX2                                ' Launch simplex
lpx_print_sol LPX2, "Sol2"            ' Write Solution to file Sol2

Files Prob1 and Prob2 are identical
Files sol1 and sol2 are different

Any idea ?

Thanks
--
Thierry Colomb

On Thu, 18 Dec 2003 21:34:56 +0300, Andrew Makhorin <address@hidden> wrote:

I use API to solve an Integer Problem using lpx_simplex folowed by
lpx_integer.

After lpx_simplex has runned, if I relaunch it, I get the same solution to
my problem: Correct
BUT
after lpx_simplex AND lpx_integer have runned, if I relaunch lpx_simplex,
I get a different solution !

This may happen only if you change something in the problem object
between calls to lpx_simplex. If you do not change anything, there must
be identical results reported by lpx_simplex independently on calls to
lpx_integer, because the latter rouitine does not change LP basis
created by lpx_simplex.

lib_free_env and lib_init_env are called between the two runs but it seems
it's not enough and some variables are not correctly re-initialized. Any
idea ?

Note that lib_free_env frees all memory internally allocated by glpk
routines and thereby invalidates *all* glpk program objects which still
exist. In particular, if you create LP problem object (using
lpx_create_prob, lpx_read_mps, etc.) and then call lib_free_env, the LP
problem object is automatically destroyed.





reply via email to

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