<br>More on multiple calls to IpoptSolve(...)<br><br>I get following error when the function is invoked second time.<br><br>EXIT: Converged to a point of local infeasibility. Problem may be infeasible.<br><br><br>Attached is the code for your quick reference.<br>
<br><br><br>Here is code snippet ......<br><br>.................<br>.................<br> Index j; /* generic counter */<br><br> for (j=0;j<10;j++) { /* Basically want to execute IpoptSolve 10 times with different values on constraints */<br>
<br> /* Number of nonzeros in the Jacobian of the constraints */<br> Index nele_jac = 6;<br> /* Number of nonzeros in the Hessian of the Lagrangian (lower or<br> upper triangual part only) */<br> Index nele_hess = 6;<br>
/* indexing style for matrices */<br> Index index_style = 0; /* C-style; start counting of rows and column<br> indices at 0 */<br><br> /* set the number of variables and allocate space for the bounds */<br>
n=3;<br> x_L = (Number*)malloc(sizeof(Number)*n);<br> x_U = (Number*)malloc(sizeof(Number)*n);<br> /* set the values for the variable bounds */<br> for (i=0; i<n; i++) {<br> x_L[i] = 0.0;<br> x_U[i] = 1.0;<br>
}<br><br> /* set the number of constraints and allocate space for the bounds */<br> m=2;<br> g_L = (Number*)malloc(sizeof(Number)*m);<br> g_U = (Number*)malloc(sizeof(Number)*m);<br><br> /* set the values of the constraint bounds */<br>
g_L[0] = 0.065 + j*0.05; /* increment return by 5% */<br> g_U[0] = 2e19;<br> g_L[1] = 1;<br> g_U[1] = 1;<br><br> /* create the IpoptProblem */<br> nlp = CreateIpoptProblem(n, x_L, x_U, m, g_L, g_U, nele_jac, nele_hess,<br>
index_style, &eval_f, &eval_g, &eval_grad_f,<br> &eval_jac_g, &eval_h);<br><br> /* We can free the memory now - the values for the bounds have been<br>
copied internally in CreateIpoptProblem */<br> free(x_L);<br> free(x_U);<br> free(g_L);<br> free(g_U);<br><br> /* Set some options. Note the following ones are only examples,<br> they might not be suitable for your problem. */<br>
AddIpoptNumOption(nlp, "tol", 1e-7);<br> AddIpoptStrOption(nlp, "mu_strategy", "adaptive");<br> AddIpoptStrOption(nlp, "output_file", "ipopt.out");<br><br> /* allocate space for the initial point and set the values */<br>
x = (Number*)malloc(sizeof(Number)*n);<br> x[0] = 0.2;<br> x[1] = 0.4;<br> x[2] = 0.4;<br><br> /* allocate space to store the bound multipliers at the solution */<br> mult_x_L = (Number*)malloc(sizeof(Number)*n);<br>
mult_x_U = (Number*)malloc(sizeof(Number)*n);<br><br> /* solve the problem */<br> status = IpoptSolve(nlp, x, NULL, &obj, NULL, mult_x_L, mult_x_U, NULL);<br><br> if (status == Solve_Succeeded) {<br> printf("\n\nSolution of the primal variables, x\n");<br>
for (i=0; i<n; i++) {<br> printf("x[%d] = %e\n", i, x[i]);<br> }<br><br> printf("\n\nSolution of the bound multipliers, z_L and z_U\n");<br> for (i=0; i<n; i++) {<br> printf("z_L[%d] = %e\n", i, mult_x_L[i]);<br>
}<br> for (i=0; i<n; i++) {<br> printf("z_U[%d] = %e\n", i, mult_x_U[i]);<br> }<br><br> printf("\n\nObjective value\n");<br> printf("f(x*) = %e\n", obj);<br> }<br><br>
/* free allocated memory */<br> FreeIpoptProblem(nlp);<br> free(x);<br> free(mult_x_L);<br> free(mult_x_U);<br> }<br><br>...........................<br>...........................<br>..........................<br>
<br><br><div class="gmail_quote">On Tue, Apr 21, 2009 at 11:57 AM, Suresh Pamujula <span dir="ltr"><<a href="mailto:suresh.pamujula@gmail.com">suresh.pamujula@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">On 4/20/09, Suresh Pamujula <<a href="mailto:suresh.pamujula@gmail.com">suresh.pamujula@gmail.com</a>> wrote:<br>
> Hello -<br>
><br>
> I want to inquire if there is a way to invoke functions<br>
><br>
> CreateIpoptProblem(....)<br>
> and<br>
> IpoptSolve(...)<br>
><br>
> multiple times with different lower bound on one of the constraints.<br>
><br>
><br>
><br>
> I tried to call within a for loop, but it gives me "infeasible solution"<br>
> when it<br>
> is invoked second time.<br>
><br>
><br>
> Any help is truly appreciated.<br>
><br>
><br>
><br>
> suresh<br>
><br>
</div></div></blockquote></div><br>