help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] variable object and deletions


From: Daniel Gustafson
Subject: Re: [Help-glpk] variable object and deletions
Date: Wed, 20 Jan 2010 10:56:51 -0600
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)


Suppose you would like to use a variable object (a C structure, or C++ class, 
or Python class, etc) to represent a column in GLPK, it is probably natural to 
let the variable object have an integer field called 'index', which is the 
index of this variable in the GLPK model (the API of GLPK use this index very 
often). But there is a problem: when you delete a variable, you must update all 
this field for all variables behind the deleted variable. I am also aware of 
another index, which is the name of each variable, but it is less efficient 
(probably OK if doing Python). I wonder if there is a more elegant way to 
implement a variable object that would significantly brings down the overhead 
involved with variable deletions. Similar problem can be proposed for 
constraints, of course, and I suspect the solution is similar too.

My experience has been that if you delete an object along with its index (and any rows that reference that index), the column corresponding to that index becomes a "free" variable and does not appear to affect the solution. It's possible that this is only true because I normally use the pre-solver to find and throw out nonsensical stuff. At any rate it appears that GLPK (at least when using the pre-solvers) uses indexes as row and column identifiers and not as absolute addresses.




reply via email to

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