[Ipopt] ipopt - Multiple calls

Suresh Pamujula suresh.pamujula at gmail.com
Wed Apr 22 20:05:23 EDT 2009


Hi Andreas -

The problem is not infeasible. I ran it with different lower bound and it
gave me an answer I expected.

Also, if I run the loop 10 times with same constraint bounds, e.g., g_L[0] =
0.065, I don't get any
infeasible solution, but I get correct solution everytime.

suresh


On Wed, Apr 22, 2009 at 7:10 PM, Andreas Waechter
<andreasw at watson.ibm.com>wrote:

> Hi Suresh,
>
> Maybe this is not an error, maybe your problem is indeed infeasible if you
> increase the lower bound on the first constraint...?  Do you also get the
> same behavior if you run the loop 10 times but always set the same
> constraint bounds, e.g., g_L[0] = 0.065, or even relax it as j increases, as
> g_L[0] = 0.065 - j*0.05 ?
>
> Andreas
>
>
> On Tue, 21 Apr 2009, Suresh Pamujula wrote:
>
>  More on multiple calls to IpoptSolve(...)
>>
>> I get following error when the function is invoked second time.
>>
>> EXIT: Converged to a point of local infeasibility. Problem may be
>> infeasible.
>>
>>
>> Attached is the code for your quick reference.
>>
>>
>>
>> Here is code snippet ......
>>
>> .................
>> .................
>>  Index j;                             /* generic counter */
>>
>>  for (j=0;j<10;j++) {  /* Basically want to execute IpoptSolve 10 times
>> with different values on constraints */
>>
>>   /* Number of nonzeros in the Jacobian of the constraints */
>>   Index nele_jac = 6;
>>   /* Number of nonzeros in the Hessian of the Lagrangian (lower or
>>    upper triangual part only) */
>>   Index nele_hess = 6;
>>   /* indexing style for matrices */
>>   Index index_style = 0; /* C-style; start counting of rows and column
>>                           indices at 0 */
>>
>>   /* set the number of variables and allocate space for the bounds */
>>   n=3;
>>   x_L = (Number*)malloc(sizeof(Number)*n);
>>   x_U = (Number*)malloc(sizeof(Number)*n);
>>   /* set the values for the variable bounds */
>>   for (i=0; i<n; i++) {
>>     x_L[i] = 0.0;
>>     x_U[i] = 1.0;
>>   }
>>
>>   /* set the number of constraints and allocate space for the bounds */
>>   m=2;
>>   g_L = (Number*)malloc(sizeof(Number)*m);
>>   g_U = (Number*)malloc(sizeof(Number)*m);
>>
>>   /* set the values of the constraint bounds */
>>   g_L[0] = 0.065 + j*0.05;  /* increment return by 5% */
>>   g_U[0] = 2e19;
>>   g_L[1] = 1;
>>   g_U[1] = 1;
>>
>>   /* create the IpoptProblem */
>>   nlp = CreateIpoptProblem(n, x_L, x_U, m, g_L, g_U, nele_jac, nele_hess,
>>                          index_style, &eval_f, &eval_g, &eval_grad_f,
>>                          &eval_jac_g, &eval_h);
>>
>>   /* We can free the memory now - the values for the bounds have been
>>    copied internally in CreateIpoptProblem */
>>   free(x_L);
>>   free(x_U);
>>   free(g_L);
>>   free(g_U);
>>
>>   /* Set some options.  Note the following ones are only examples,
>>    they might not be suitable for your problem. */
>>   AddIpoptNumOption(nlp, "tol", 1e-7);
>>   AddIpoptStrOption(nlp, "mu_strategy", "adaptive");
>>   AddIpoptStrOption(nlp, "output_file", "ipopt.out");
>>
>>   /* allocate space for the initial point and set the values */
>>   x = (Number*)malloc(sizeof(Number)*n);
>>   x[0] = 0.2;
>>   x[1] = 0.4;
>>   x[2] = 0.4;
>>
>>   /* allocate space to store the bound multipliers at the solution */
>>   mult_x_L = (Number*)malloc(sizeof(Number)*n);
>>   mult_x_U = (Number*)malloc(sizeof(Number)*n);
>>
>>   /* solve the problem */
>>   status = IpoptSolve(nlp, x, NULL, &obj, NULL, mult_x_L, mult_x_U, NULL);
>>
>>   if (status == Solve_Succeeded) {
>>   printf("\n\nSolution of the primal variables, x\n");
>>   for (i=0; i<n; i++) {
>>     printf("x[%d] = %e\n", i, x[i]);
>>   }
>>
>>   printf("\n\nSolution of the bound multipliers, z_L and z_U\n");
>>   for (i=0; i<n; i++) {
>>     printf("z_L[%d] = %e\n", i, mult_x_L[i]);
>>   }
>>   for (i=0; i<n; i++) {
>>     printf("z_U[%d] = %e\n", i, mult_x_U[i]);
>>   }
>>
>>   printf("\n\nObjective value\n");
>>   printf("f(x*) = %e\n", obj);
>>   }
>>
>>   /* free allocated memory */
>>   FreeIpoptProblem(nlp);
>>   free(x);
>>   free(mult_x_L);
>>   free(mult_x_U);
>>  }
>>
>> ...........................
>> ...........................
>> ..........................
>>
>>
>> On Tue, Apr 21, 2009 at 11:57 AM, Suresh Pamujula <
>> suresh.pamujula at gmail.com
>>
>>> wrote:
>>>
>>
>>  On 4/20/09, Suresh Pamujula <suresh.pamujula at gmail.com> wrote:
>>>
>>>> Hello -
>>>>
>>>> I want to inquire if there is a way to invoke functions
>>>>
>>>> CreateIpoptProblem(....)
>>>> and
>>>> IpoptSolve(...)
>>>>
>>>> multiple times with different lower bound on one of the constraints.
>>>>
>>>>
>>>>
>>>> I tried to call within a for loop, but it gives me "infeasible solution"
>>>> when it
>>>> is invoked second time.
>>>>
>>>>
>>>> Any help is truly appreciated.
>>>>
>>>>
>>>>
>>>> suresh
>>>>
>>>>
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.coin-or.org/pipermail/ipopt/attachments/20090422/30e66113/attachment.html 


More information about the Ipopt mailing list