[Coin-discuss] re: Preserving row and column names using readLP & OsiSolverInterface

Francois Margot fmargot at andrew.cmu.edu
Sat Feb 4 08:54:31 EST 2006



On Thu, 2 Feb 2006, John J Forrest wrote:

> Francois,
>
> I strongly disagree.  If there are no names or no duplicates then the code
> I added is not invoked.  If there are duplicates then without my change
> accessing some row names will give a segmentation error.  The hash
> functions are never used for row names and it is only row names I am
> checking.

First, there is now a memory leak: since stopHash(0) sets numberHash[0] to 0,
when the CoinLpIO object is deleted, the array names_[0] is not freed properly.

Second, the method CoinLpIO::rowIndex() now sometimes behaves incorrectly: 
asking for the index of a row having a particular name always returns -1, 
i.e. it claims that no name is in the list of row names.

>
> So I think my solution does not harm anyone and helps people who have
> duplicates.

One bug is replaced by two. I am not convinced that this is an improvment.

I think that we have to decide if we want to support duplicate row names
or not. In the current implementation, the warning that is printed when
non distinct row names are identified was intended to warn the user that
strange behavior (including possible seg faults) might come from that fact.

If we want to fully support identical row names, I see 2 possibilities:

1) Remove hash tables for row names and replace them by a vector. This requires
changes in several methods dealing with row names.

2) Have hash tables storing duplicates. Requires a new set of hash table
methods.

In addition, we have to provide a method that returns all the indices of rows
having a given name.

The other possibility (my preference) is to tighten the restrictions on names:
all row names must be distinct. If non distinct names are provided, then
either an error is raised or the names are automatically replaced by default 
names.

I can make the changes once we agree on what we want to do.

Francois






More information about the Coin-discuss mailing list