<br><font size=2 face="sans-serif">Kyle,</font>
<br>
<br><font size=2 face="sans-serif">I will write a constructor for you.
&nbsp;If you still need more memory there are a few more tricks e.g. &nbsp;replaceMatrix
may not need two copies and you can switch off a row copy (but it will
be slower).</font>
<br>
<br><font size=2 face="sans-serif">May be ready by tomorrow.</font>
<br>
<br><font size=2 face="sans-serif">John Forrest</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Kyle Ellrott &lt;kellrott@csbl.bmb.uga.edu&gt;</b>
</font>
<br><font size=1 face="sans-serif">Sent by: coin-lpsolver-bounces@list.coin-or.org</font>
<p><font size=1 face="sans-serif">03/08/2005 11:39 AM</font>
<td width=59%>
<table width=100%>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td valign=top><font size=1 face="sans-serif">coin-lpsolver@list.coin-or.org</font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td valign=top>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td valign=top><font size=1 face="sans-serif">Re: [Coin-lpsolver] Constraint
matrix</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2><tt>I've been playing around with the ClpSimplex solver
directly as <br>
suggested. &nbsp;Upon further research, given the nature of my problem,
I <br>
may want to skip the Branch and Bound interface altogether (my <br>
branches, which rarely exist, are binary in nature, so no need for a <br>
linear cutting plane)<br>
Currently I'm trying to tackle a problem with a size of 10861552 <br>
Column, 103481 rows, and 21788000 elements, but as mentioned before <br>
there only exists the values +1,0,-1, so using a ClpPlusMinusOneMatrix
<br>
is preferable.<br>
Anyway, I'm still playing around with quickly constructing a large <br>
ClpPlusMinusOneMatrix. &nbsp;Originally, when I used the CoinPackedMatrix,
I <br>
utilized the triplet array description of the matrix to initialize <br>
(row, column, element) to initialize the structure. &nbsp;But because this
<br>
interface is not part of the ClpPlusMinusOneMatrix class, I rewrote my
<br>
code to generate the matrix one column at a time, and attempt to use <br>
the appendCol call in ClpPlusMinusOneMatrix. &nbsp;At this point I found
<br>
out, this might not work,<br>
 From the looks of the source code, and <br>
http://www.coin-or.org/Clp/userguide/ch03s02.html it looks as if the <br>
only way to initialize a ClpPlusMinusOneMatrix is to first create a <br>
ClpPackedMatrix, and then initialize the PlusMinus matrix by passing in
<br>
the PackedMatrix.<br>
But currently I run out of memory creating the ClpPackedMatrix on <br>
certain problems, so I can't even create the PlusMinus matrix.<br>
<br>
The problem is that ClpPackedMatrix creation is a bit of a memory hog,
<br>
because at it's worst point I have two copies of the matrix in memory <br>
at one time &nbsp;(one in the linked list of CoinBuild, and on in the matrix
<br>
inside of ClpSimplex), or I could try building the matrix one column at
<br>
a time, but that takes way to much time. &nbsp;The triplet method is a
bit <br>
better, because it removes a bit of memory overhead associated in <br>
describing each of the columns separately, but PlusMinus doesn't take a
<br>
CoinPackedMatrix as a constructor argument. &nbsp;But even then, I still
use <br>
a lot of memory creating a PackedMatrix before creating the smaller <br>
PlusMinus one.<br>
<br>
Is it possible to create a ClpPlusMinusOneMatrix without creating a <br>
ClpPackedMatrix first?<br>
<br>
I think the following call might be the way to go, but the <br>
documentation is kind of sparse in terms of how to use it...<br>
<br>
 &nbsp;ClpPlusMinusOneMatrix::ClpPlusMinusOneMatrix &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ( &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; numberRows,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
numberColumns,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bool
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
columnOrdered,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;const
int * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
indices,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;const
CoinBigIndex * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; startPositive,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;const
CoinBigIndex * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; startNegative<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<br>
<br>
<br>
Kyle<br>
<br>
<br>
<br>
&gt;<br>
&gt; Kyle,<br>
&gt;<br>
&gt; While Cbc i.e. Osi could allow more types of matrices I am not sure
it <br>
&gt; is a good idea for Branch and Cut. &nbsp;A bit of extra storage before
<br>
&gt; entering branch and cut &nbsp;is the least of your worries. &nbsp;In
branch and <br>
&gt; cut the cut generators all expect a CoinPackedMatrix and if they add
<br>
&gt; any cuts they will destroy any special structure.<br>
&gt;<br>
&gt; If you are masochistic enough to want to try and stress the code you
<br>
&gt; could do the following:<br>
&gt;<br>
&gt; Get an OsiClpSolverInterface solver<br>
&gt; get a ClpSimplex pointer using getModelPtr()<br>
&gt; create model and pass in +-1 matrix - you can get clues from <br>
&gt; Clp/Test/unitTest.cpp<br>
&gt; pass solver to Cbc<br>
&gt;<br>
&gt; It will do the initial solve. &nbsp;If it does not add cuts it should
stay <br>
&gt; as +- matrix. &nbsp;If it does cuts it &quot;should&quot; magically
become an <br>
&gt; ordinary matrix - if it fails then I will fix.<br>
&gt;<br>
&gt; John Forrest<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Kyle Ellrott &lt;kellrott@csbl.bmb.uga.edu&gt;<br>
&gt;<br>
&gt; Sent by: coin-lpsolver-bounces@list.coin-or.org<br>
&gt;<br>
&gt;<br>
&gt; 03/03/2005 11:09 AM<br>
&gt;<br>
&gt;<br>
&gt; To<br>
&gt;<br>
&gt; coin-lpsolver@list.coin-or.org<br>
&gt;<br>
&gt;<br>
&gt; cc<br>
&gt;<br>
&gt;<br>
&gt; Subject<br>
&gt;<br>
&gt; Re: [Coin-lpsolver] Constraint matrix<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; I've been looking through the source tree to get a better understanding<br>
&gt; &nbsp;of what's going on. &nbsp;But I do have a few questions.<br>
&gt; &nbsp;From my understanding CoinPackedMatrix is derived from <br>
&gt; ClpPackedMatrix,<br>
&gt; &nbsp;and adds a few functions (actually It looks like it adds about
38 <br>
&gt; pages<br>
&gt; &nbsp;worth of code to ClpPackMatrix). &nbsp;Do all those functions
need to be<br>
&gt; &nbsp;added before Cbc can utilize the matrix?<br>
&gt;<br>
&gt; &nbsp;There is no equivalent Coin class for the ClpPlusMinusOneMatrix.
&nbsp;I'm<br>
&gt; &nbsp;assuming one would have to be created before it could be used
in the<br>
&gt; &nbsp;CbcModel interface. &nbsp;Of course I would also have to add
a loadProblem<br>
&gt; &nbsp;method to Cbc that used this hypothetical CoinPlusMinusOneMatrix.
<br>
&gt; &nbsp;Then<br>
&gt; &nbsp;maybe change the internal Cbc matrix pointers is a more generic<br>
&gt; &nbsp;CoinMatrixBase (which doesn't exist either) which would be an
abstract<br>
&gt; &nbsp;based on ClpMatrixBase, rather then the current CoinPackedMatrix.<br>
&gt;<br>
&gt; &nbsp;Is this what it would take to get a plus/minus one matrix working
in<br>
&gt; &nbsp;Cbc? &nbsp;Or have I over complicated the problem?<br>
&gt;<br>
&gt; &nbsp;Kyle<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; &nbsp;&gt; Thank you, that helps ;-)<br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt; But I do have one problem. &nbsp;According the page mentioned,
both<br>
&gt; &nbsp;&gt; ClpPlusMinusOneMatrix and ClpPackedMatrix both inherit
from<br>
&gt; &nbsp;&gt; ClpMatrixBase. &nbsp;The problem is that OsiClpSolverInterface's<br>
&gt; &nbsp;&gt; loadProblem only mentions CoinPackedMatrix (which I think
is the <br>
&gt; same<br>
&gt; &nbsp;&gt; as ClpPackedMatrix), but not the parent class of ClpMatrixBase.
&nbsp;So<br>
&gt; &nbsp;&gt; when I try to pass a ClpPlusMinusOneMatrix to <br>
&gt; OsiClpSolverInterface's<br>
&gt; &nbsp;&gt; loadProblem, I get something like<br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt; intpro_threading.cc:766: error: no matching function for
call to `<br>
&gt; &nbsp;&gt; &nbsp; &nbsp;OsiClpSolverInterface::loadProblem(ClpPlusMinusOneMatrix&amp;,
<br>
&gt; double*&amp;,<br>
&gt; &nbsp;&gt; &nbsp; &nbsp;double*&amp;, double*&amp;, double*&amp;,
double*&amp;)'<br>
&gt; &nbsp;&gt; /Users/kye/COIN/include/OsiClpSolverInterface.hpp:600:
error:<br>
&gt; &nbsp;&gt; candidates are:<br>
&gt; &nbsp;&gt; &nbsp; &nbsp;virtual void OsiClpSolverInterface::loadProblem(const<br>
&gt; &nbsp;&gt; CoinPackedMatrix&amp;,<br>
&gt; &nbsp;&gt; &nbsp; &nbsp;const double*, const double*, const double*,
const double*, const<br>
&gt; &nbsp;&gt; double*)<br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt; Any thoughts?<br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt; Kyle<br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt;&gt; I think you will find this page of the CLP documentation
will help<br>
&gt; &nbsp;&gt;&gt; you:<br>
&gt; &nbsp;&gt;&gt;<br>
&gt; &nbsp;&gt;&gt; http://www.coin-or.org/Clp/userguide/ch03s02.html<br>
&gt; &nbsp;&gt;&gt;<br>
&gt; &nbsp;&gt;&gt; In other words, there's (supposed to be) a matrix class
specific to<br>
&gt; &nbsp;&gt;&gt; your situation.<br>
&gt; &nbsp;&gt;&gt;<br>
&gt; &nbsp;&gt;&gt; At 02:38 PM 3/2/2005, Kyle Ellrott wrote:<br>
&gt; &nbsp;&gt;&gt;&gt; I'm curious about the CoinPackedMatrix structure
that I use to <br>
&gt; setup<br>
&gt; &nbsp;&gt;&gt;&gt; my constraint matrix for my integer programming
problem. &nbsp;From <br>
&gt; what<br>
&gt; &nbsp;&gt;&gt;&gt; I understand so far, it's input data is doubles.
&nbsp;But for my<br>
&gt; &nbsp;&gt;&gt;&gt; particular problem, the only values I put in it
are -1, 1, and 0 <br>
&gt; (0<br>
&gt; &nbsp;&gt;&gt;&gt; being being cells that aren't mentioned in my description).
&nbsp;By<br>
&gt; &nbsp;&gt;&gt;&gt; using a double rather then a char, I'm using 8
time more memory <br>
&gt; then<br>
&gt; &nbsp;&gt;&gt;&gt; I need to.<br>
&gt; &nbsp;&gt;&gt;&gt; Is there are more efficient method to describe
this matrix?<br>
&gt; &nbsp;&gt;&gt;&gt;<br>
&gt; &nbsp;&gt;&gt;&gt; Kyle<br>
&gt; &nbsp;&gt;&gt;&gt;<br>
&gt; &nbsp;&gt;&gt;&gt; _______________________________________________<br>
&gt; &nbsp;&gt;&gt;&gt; Coin-lpsolver mailing list<br>
&gt; &nbsp;&gt;&gt;&gt; Coin-lpsolver@list.coin-or.org<br>
&gt; &nbsp;&gt;&gt;&gt; http://list.coin-or.org/mailman/listinfo/coin-lpsolver<br>
&gt; &nbsp;&gt;&gt;<br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt; _______________________________________________<br>
&gt; &nbsp;&gt; Coin-lpsolver mailing list<br>
&gt; &nbsp;&gt; Coin-lpsolver@list.coin-or.org<br>
&gt; &nbsp;&gt; http://list.coin-or.org/mailman/listinfo/coin-lpsolver<br>
&gt;<br>
&gt; &nbsp;_______________________________________________<br>
&gt; &nbsp;Coin-lpsolver mailing list<br>
&gt; &nbsp;Coin-lpsolver@list.coin-or.org<br>
&gt; &nbsp;http://list.coin-or.org/mailman/listinfo/coin-lpsolver<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Coin-lpsolver mailing list<br>
&gt; Coin-lpsolver@list.coin-or.org<br>
&gt; http://list.coin-or.org/mailman/listinfo/coin-lpsolver<br>
 &nbsp;_______________________________________________<br>
Coin-lpsolver mailing list<br>
Coin-lpsolver@list.coin-or.org<br>
http://list.coin-or.org/mailman/listinfo/coin-lpsolver<br>
</tt></font>
<br>