Hello, what does this exactly means?<br><br><span style="font-family:courier new,monospace">Build sparse drivers: yes</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">Build with ColPack: no</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">Compressed sparse structures will not be available</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">Only sparsity patterns can be computed</span><br>
<br>I'm using ADOL-C as AD tool for the IPOPT solver and having problems with ColPack when I need to run multiple optimisation problems (in series) I implemented an algorithm for finding sparsity structure for my specific model, at least for the Jacobian.<br>
<br>Then I replaced the eval_jac_g() function in the LuksanVlcek1 or MittelmannDistCntrlNeumA examples (ADOL-C/examples/additional_examples/ipopt) with:<br><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">eval_jac_g(){</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> if (values == NULL) {</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> // return the structure of the jacobian,</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> for(Index idx=0;idx<nzjelements.size();idx++){</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> iRow[idx] = nzjelements[idx][0];</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> jCol[idx] = nzjelements[idx][1];</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> }</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> }</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> else {</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> // return the values of the jacobian of the constraints</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> jacobian(tag_g,m,n,x,Jac);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> for(Index idx=0;idx<nzjelements.size();idx++){</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> values[idx] = Jac[nzjelements[idx][0]][nzjelements[idx][1]];</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> }</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> }</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> return true;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">}</span><br>
<br>where <span style="font-family:courier new,monospace">vector < vector <Index> ></span> nzelements is the vector of non zero elements in my model, with <span style="font-family:courier new,monospace">nzelements[i][0]</span> the row position and <span style="font-family:courier new,monospace">nzelements[i][1]</span> the column one.<br>
<br>Is this the most efficient implementation or there could be a better way to compute sparsity patterns?<br><br>Thank you,<br> Antonello<br><br><br><br clear="all"><br>-- <br>Antonello Lobianco<br>INRA, Laboratoire d'Economie Forestière<br>
14 Rue Girardet - 54000 Nancy, France<br>Tel: +33.652392310<br>Email: <a href="mailto:antonello.lobianco@nancy-engref.inra.fr" target="_blank">antonello.lobianco@nancy-engref.inra.fr</a><br><a href="http://antonello.lobianco.org/" target="_blank">http://antonello.lobianco.org</a><br>