<br><font size=2 face="sans-serif">Hi, Laci,</font>
<br>
<br><font size=2 face="sans-serif">Thanks for your reply. I rewrote the
readLp() method, replaced its local variable "COINLpIO m" by
a COINLpIO pointer passed in, from this pointer, I can extract variable
names by calling COINLpIO::columnName() method. This workaround seems to
work, but I am not sure whether the variable names I got are arranged in
the same order as the solution I got from calling OsiSolverInterface::getColsolution().
Can Francois please answer this question?</font>
<br>
<br>
<br><font size=2 face="sans-serif">-------------------------------------------------</font>
<br>
<br><tt><font size=2>si=OsiSolverInterface;<br>
si= new OsiClpSolverInterface; </font></tt>
<br><tt><font size=2>COINLpIO * rPrt = new COINLpIO();</font></tt>
<br><tt><font size=2><br>
si->readLp(rPrt, "t1.lp"); <--------the new readLp()
method<br>
<br>
// solve the problem<br>
<br>
int n=si->getNumcols();<br>
solution =si->getColsolution();<br>
for(int i=0;i<n; i++){</font></tt>
<br><font size=2 color=#820040 face="Courier New"><b>
const</b></font><font size=2 face="Courier New">
</font><font size=2 color=#820040 face="Courier New"><b>char</b></font><font size=2 face="Courier New">
*name=rPrt->columnName(i);</font><tt><font size=2> <-----------Is
it right to do so?<br>
cout<<name<<" = "<<solution[i]<<endl;
<br>
}<br>
-------------------------------------</font></tt>
<br>
<br>
<br><tt><font size=2>Cheers</font></tt>
<br><tt><font size=2>Paul<br>
</font></tt>
<br>
<br><font size=2 face="sans-serif"><br>
</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>ladanyi@watson.ibm.com</b>
</font>
<br><font size=1 face="sans-serif">Sent by: coin-discuss-bounces@list.coin-or.org</font>
<p><font size=1 face="sans-serif">04/21/2006 01:24 PM</font>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="sans-serif">Please respond to<br>
Discussions about open source software for Operations Research
<coin-discuss@list.coin-or.org></font></div></table>
<br>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">Discussions about open source software
for Operations Research <coin-discuss@list.coin-or.org></font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td><font size=1 face="sans-serif">Francois Margot <fmargot@andrew.cmu.edu></font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">Re: [Coin-discuss] how to get variable
names in CPLEX LP format using OSI?</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><tt><font size=2>Hi Paul,<br>
<br>
The bad news: as far as I know (but Francois may correct me) the LP format<br>
reader loses the variable names... :-(<br>
<br>
Sorry,<br>
--Laci<br>
<br>
On Thu, 20 Apr 2006, Pu Huang wrote:<br>
<br>
> If someone uses OsiSolverInterface::readLp() to read a problem instance
in <br>
> CPLEX LP format and subsequently solve the problem. How to extract
the <br>
> variable names from the solutions?<br>
> <br>
> ------------------------------------<br>
> <br>
> si=OsiSolverInterface;<br>
> si= new OsiClpSolverInterface; <br>
> si->readLp("t1.lp");<br>
> <br>
> // solve the problem<br>
> <br>
> int n=si->getNumcols();<br>
> solution =si->getColsolution();<br>
> for(int i=0;i<n, i++){<br>
> string name=si->??????
(what function to call?)<br>
> cout<<name<<" = "<<solution[i]<<endl;<br>
> }<br>
> -------------------------------------<br>
> <br>
> I tried OsiSolverInterface::getColName(), but it returns names like
<br>
> "C000001", not the original variable names in the LP file.
<br>
> <br>
> Cheers<br>
> Paul Huang<br>
<br>
_______________________________________________<br>
Coin-discuss mailing list<br>
Coin-discuss@list.coin-or.org<br>
http://list.coin-or.org/mailman/listinfo/coin-discuss<br>
</font></tt>
<br>