[Coin-discuss] Column and row names in OsiSolverInterface

Michael Hennebry hennebry at web.cs.ndsu.nodak.edu
Thu Jun 9 11:28:59 EDT 2005


On Thu, 9 Jun 2005, John J Forrest wrote:

> At present there is no way to set and get names for rows and/or columns of
> a model.  It has been suggested to me that this might be useful.
>
> Are there any objections?  The default would be that setting would do
> nothing and getting would return a std::string Rnnnnnnn or Cnnnnnnn.  Are
> there any thoughts on setting - one at a time or in groups?

I've used row and column names for two things:
To print a problem so that I can determine whether it's
the problem intended and as a means of identification
that will not be defeated by automatic renumbering.

For the former, the precise specification
probably isn't all that important,
though you might want to consider whether
you want to return a string or a pointe to it.

If Osi solvers are not allowed to renumber, the latter is moot.
Otherwise, consider something more generic.

class ColData {
    virtual std::string *getName() const { return 0; }
} ;

virtual void OsiSolverInterface::setColData(int col, ColData *cd) { ... }

virtual ColData *OsiSolverInterface::getColData(int col) const { ... }

virtual std::string *OsiSolverInterface::getColName(int col) const {
    ColData *cd=getColData(col);
    if(cd) {
        std::string *nm=cd-->getName();
        if(nm) return nm;
    }
    return Cnnnnnnn(col);
}

When implementing Cnnnnnnn, consider the actual number of columns.
If there are only 10,000 variables, four digits should suffice.

-- 
Mike   hennebry at web.cs.ndsu.NoDak.edu
"There are three kinds of people,
those who can count and those who can't."




More information about the Coin-discuss mailing list