[Coin-discuss] how to get variable names in CPLEX LP format using OSI?

John J Forrest jjforre at us.ibm.com
Sat Apr 22 06:21:00 EDT 2006


Paul,

The standard OsiSolverInterface does not keep names so
OsiSolverInterface::readLp does not keep names.
OsiClpSolverInterface::readLp does keep names in exactly the same way (and
order) as readMps.

One possible minor problem was that readLp was not declared virtual in
OsiSolverInterface while it was virtual in OsiClpSolverInterface.  I have
changed it to virtual in OsiSolverInterface.hpp.

John


                                                                           
             ladanyi at watson.ib                                             
             m.com                                                         
             Sent by:                                                   To 
             coin-discuss-boun         Discussions about open source       
             ces at list.coin-or.         software for Operations Research    
             org                       <coin-discuss at list.coin-or.org>     
                                                                        cc 
                                       Francois Margot                     
             04/21/06 01:24 PM         <fmargot at andrew.cmu.edu>            
                                                                   Subject 
                                       Re: [Coin-discuss] how to get       
             Please respond to         variable names in CPLEX LP format   
             Discussions about         using OSI?                          
                open source                                                
               software for                                                
                Operations                                                 
                 Research                                                  
             <coin-discuss at lis                                             
              t.coin-or.org>                                               
                                                                           
                                                                           




Hi Paul,

The bad news: as far as I know (but Francois may correct me) the LP format
reader loses the variable names... :-(

Sorry,
--Laci

On Thu, 20 Apr 2006, Pu Huang wrote:

> If someone uses OsiSolverInterface::readLp() to read a problem instance
in
> CPLEX LP format and subsequently solve the problem. How to extract the
> variable names from the solutions?
>
> ------------------------------------
>
> si=OsiSolverInterface;
> si= new OsiClpSolverInterface;
> si->readLp("t1.lp");
>
> // solve the problem
>
> int n=si->getNumcols();
> solution =si->getColsolution();
> for(int i=0;i<n, i++){
>            string name=si->?????? (what function to call?)
>         cout<<name<<" = "<<solution[i]<<endl;
> }
> -------------------------------------
>
> I tried OsiSolverInterface::getColName(), but it returns names like
> "C000001", not the original variable names in the LP file.
>
> Cheers
> Paul Huang

_______________________________________________
Coin-discuss mailing list
Coin-discuss at list.coin-or.org
http://list.coin-or.org/mailman/listinfo/coin-discuss





More information about the Coin-discuss mailing list