Hi Nuno -<br><br>While I can't shed any light on why setting the maximum number of iterations this way throws an exception, as a work around, have you tried setting the maximum number of iterations via an options file? I set this value using a file called ipopt.opt in the calling directory which has (among other options) the line<br>
<br>max_iter 500<br><br>This works for my build of Ipopt without any errors, and additionally allows you to change max_iter without having to re-compile your program, as ipopt.opt is read at run time.<br><br>- Seth<br><br>
<div class="gmail_quote">On Tue, Oct 9, 2012 at 8:17 AM, Nuno Silva <span dir="ltr"><<a href="mailto:pg17455@alunos.uminho.pt" target="_blank">pg17455@alunos.uminho.pt</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
Greetings<br clear="all">
<div><br>
</div>
<div>I'm using the C++ interface and I'm trying to set the "max_iter" option, but I get an exception:</div>
<div>"...Microsoft C++ exception: std::bad_alloc at memory location..."</div>
<div><br>
</div>
<div>Here is the surrounding code, the exception is thrown at the second line:</div>
<div><br>
</div>
<div>
<div><font face="courier new, monospace">SmartPtr<IpoptApplication> app = IpoptApplicationFactory();</font></div>
<div><font face="courier new, monospace">app->Options()->SetIntegerValue("max_iter", 500);</font></div>
<div><font face="courier new, monospace">ApplicationReturnStatus status = app->Initialize();</font></div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Thanks</div><span class="HOEnZb"><font color="#888888">
<div>Nuno</div>
</font></span></div>
</blockquote></div><br>