<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div>Hi all:<br><br>I have a rather large portfolio optimization problem. I am trying to use IpOpt with Mumps (due to licensing issues).<br>I first outline the steps to create the problem.<br><br>I derive a class COpt from IpOpt. <br>An instance of COpt is p_optdata<br><br>I next create the two smart pointers as follows:<br>SmartPtr<COpt> p_optdata;<br>SmartPtr<TNLP> p_optdata_tnlp;<br><br>p_optdata = new COpt();<br>p_optdata_tnlp = GetRawPtr(p_optdata);<br><br>I set up the problem as follows:<br><br>void CBMOptDoc::optimize()<br>{<br> // Create an instance of the IpoptApplication<br> SmartPtr<IpoptApplication> app = new IpoptApplication(false, false);<br> // Initialize the IpoptApplication and process the
options<br> ApplicationReturnStatus status;<br> status = app->Initialize();<br> if (status != Solve_Succeeded) <br> {<br> AfxMessageBox("Error during initialization");<br> return;<br> }<br> status = app->OptimizeTNLP(p_optdata_tnlp);<br><br> if (status == Solve_Succeeded)<br> {<br> Index iter_count = app->Statistics()->IterationCount();<br> Number final_obj = app->Statistics()->FinalObjective();<br> }<br>}<br><br><br><br><br><br>bool COpt::get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,<br> Index&
nnz_h_lag, IndexStyleEnum& index_style)<br>{<br> int nassets = ml.m_nAssets;<br> int kvars = nRI + nInd;<br> n = 2 * nassets;<br><br> m = 4 + kvars;<br><br> // nonzeros in the jacobian,<br> nnz_jac_g = (7 + 2 * kvars) * nassets ;<br><br> // and nonzeros in the hessian of the lagrangian<br> nnz_h_lag = (2 * nassets + 1) * (nassets + 1);<br><br> // We use the C index style for row/col entries<br> index_style = C_STYLE;<br><br> return true;<br>}<br><br><br><br>Here nassets = 501, kvars = 22 so the number of non-zeros are fairly large. I provide the needed jacobians and hessians.<br><br>When I get into app->OptimizeTNLP(p_optdata_tnlp), the application gets as far as line 1022 of dmumps-part7.f and crashes. The reason is that the arrays
IRN and ICN in the module are corrupted . A partial look at IRN shows that IRN(1) has garbage in it.<br><br>- IRN {...} INTEGER(4) <br> IRN(1) -842150450 INTEGER(4) <br> IRN(2) 1 INTEGER(4) <br> IRN(3) 2 INTEGER(4) <br> IRN(4) 2 INTEGER(4) <br> IRN(5) 3 INTEGER(4) <br> IRN(6) 3 INTEGER(4) <br><br>Similarly ICN is also corrupted at ICN(1).<br><br>Any thoughts on where I could be going wrong? Appreciate your help as I have put in a lot of
effort over the last two months on this.I wouldn't have gotten this far without your feedback. If needed I can provide the jacobian and hessians.<br><br>Thanks a lot.<br><br>Krish<br></div></div><br>
</body></html>