[Ipopt] Jipopt issue

Alberto Calzada albertocalsa at gmail.com
Fri Jan 18 10:57:32 EST 2013


Hello, Edson,

I am struggling to find a solution to these errors.

1) I am not sure if I am running properly the derivative tests in JIpopt. I
am just adding these 2 lines:
addStrOption(Ipopt.KEY_DERIVATIVE_TEST, "first-order");
addStrOption(Ipopt.KEY_DERIVATIVE_TEST_PRINT_ALL, "yes");
But the program is not printing anything.

2) When I run a big optimisation problem, I get the error I mentioned you
in my previous e-mail. But when I try to run a small optimisation problem,
the following error appears:

*
******************************************************************************
*
*This program contains Ipopt, a library for large-scale nonlinear
optimization.*
* Ipopt is released as open source code under the Common Public License
(CPL).*
*         For more information visit http://projects.coin-or.org/Ipopt*
*
******************************************************************************
*
*
*
*Option hessian_information is not chosen as limited_memory, but eval_h
returns f*
*alse.*
*Exception of type: OPTION_INVALID in file "IpTNLPAdapter.cpp" at line 869:*
* Exception message: eval_h is called but has not been implemented*
*
*
*EXIT: Invalid option encountered.*
*DEBUG [AWT-EventQueue-1] (NotificationManager.java:104) -
java.lang.ArrayIndexOu*
*tOfBoundsException: 0*
*java.lang.ArrayIndexOutOfBoundsException: 0*
*        at
model.core.Optimisation.ExtendedRuleBaseOptimisation.eval_h(ExtendedR*
*uleBaseOptimisation.java:220)*
*        at org.coinor.Ipopt.IpoptSolve(Native Method)*
*        at org.coinor.Ipopt.solve(Ipopt.java:347)*
*        at
model.core.DataStructure.SubRuleBase.optimise(SubRuleBase.java:1230)*
*        at
view.util.MeasureParametersDialog$6.actionPerformed(MeasureParameters*
*Dialog.java:158)*
*        at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)*
*        at javax.swing.AbstractButton$Handler.actionPerformed(Unknown
Source)*
*        at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown
Source)*
*        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)*
*        at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour*
*ce)*

The thing is that I have actually implemented the eval_h function! This is
my eval_h function:

* @Override*
* protected boolean eval_h(int n, double[] x, boolean new_x,*
* double obj_factor, int m, double[] lambda, boolean new_lambda,*
* int nele_hess, int[] iRow, int[] jCol, double[] values) {*
*
*
* /* return the structure. This is a symmetric matrix, fill the lower left*
* * triangle only. */*
* if(values == null){*
* /* return the structure. This is a symmetric matrix, fill the lower left*
* * triangle only. */*
* int idx = 0; /* nonzero element counter */*
* int row = 0; /* row counter for loop */*
* int col = 0; /* col counter for loop */*
*
*
* idx=0;*
* for (row = 0; row < 4; row++) {*
* for (col = 0; col <= row; col++) {*
* iRow[idx] = row;*
* jCol[idx] = col;*
* idx++;*
* }*
* }*
* nele_hess = idx;*
* }*
* else {*
* for(int i=0;i<nele_hess;i++){*
* values[i] = 0;*
* }*
* }*
* *
* return true;*
* }*

Because what I am trying to optimise are the parameters of a rule-based
knowledge representation system (weights, antecedents and consequent of
each rule and attribute) and all my constraints are of the type: g_U[k] =
a1+a2+..+aN, their second derivative (if I am not wrong) will always be
zero for all of them. That is why I always do "*values[i] = 0" *for all my
constraints.

I am downloading the Valgrind application to debug the system, but I think
that the problem I am getting now is not related with memory issues but
maybe by solving this problem when optimising small rule-bases, we might
solve also the one for big rule-bases at once...

Many thanks once again Edson, I wouldn't be able to make this thing work
without you,

All the best,

Alberto



On 18 January 2013 13:19, Edson Cordeiro do Valle <edsoncv at enq.ufrgs.br>wrote:

>     Hello Alberto
> Well, if things went wrong, I suggest to use the default approach: use
> derivative checker to detect errors on first and second derivatives.
> To see the outputs from ipopt to java it is necessary to send the outputs
> of ipopt to a java stream, through a JTextArea (implements the intermediate
> callback function in java) and analyze your output.
> The implementation in Java of this function would be something like that:
>
>     public boolean intermediate_callback(int AlgorithmMode, int iter,
>             double obj_value, double inf_pr, double inf_du, double mu,
>             double d_norm, double regularization_size, double alpha_du,
>             double alpha_pr, int ls_trials) {
>         Formatter formatter = new Formatter();
>         // publish results to the output window
>         myArea.append(formatter.format("%d \t %1.4e \t %1.2e \t %1.2e \t" +
>                 "%+1.1f \t %1.2e \t %1.1f \t %1.2e \t %1.2e \t %d",
>                 iter, obj_value, inf_pr, inf_du, mu, d_norm,
> regularization_size,
>                 alpha_du, alpha_pr, ls_trials).toString() + "\n");
>         return true;
>     }
>
> Notice that due to a swing thread issues it may be necessary to create a
> swingworker to update this values. I have a jipopt version that interacts
> with swing controls and a JTextArea using swingworkers. I will ask my
> company if I can share this implementation with COIN-Ipopt, but you can try
> the above solution.
>
> It is also possible to run your java executable in valgrind (even if it
> runs inside jvm) and check for leaks (I know that this work because Ive
> done this in the past to debug the first versions of jipopt).  The problem
> in this case is that, since jipopt.dll was not built with debug symbols,
> you may not find exactly where (what line) exactly the problem is, but it
> can give you a clue.
>
> Regards
>
>
> Em 17-01-2013 18:37, Alberto Calzada escreveu:
>
> Dear Rafael and Edson,
>
>  Thank you very much for your patience and attention. I was finally and
> just now able to solve the link issue. It was because my project is inside
> another (much bigger) open-source project, and I needed to add the jipopt
> .jar library not to the path of my own project, but to the path of the
> whole workbench. Thank you for your advise during this last month, it was
> very helpful to find the root of the problem.
> However, now I think I got another problem which I believe is out of my
> scope (it seems to occur out of the JVM, and looks like a memory error).
> Please find attached the logs of the 4 failed executions I have had.
>
>  Again, any suggestion would be more than welcome,
> Many thanks beforehand,
>
>  Best regards,
>
>  Alberto
>
>
> On 16 January 2013 23:12, Edson Cordeiro do Valle <edsoncv at enq.ufrgs.br>wrote:
>
>>    Hello Alberto
>> Can you send me your version of your project (a zipped folder) or a
>> resumed version of it? If you send me I can take a look.
>> Regards
>>
>> Em 11-01-2013 15:16, Alberto Calzada escreveu:
>>
>>  Dear Rafael,
>>>
>>> Again, thank you very much for your prompt respond and attention.
>>>
>>> That's the most strange thing: I am in Eclipse and I have added the
>>> JIpopt library (jipopt-3.2.2.jar) in the path of my project. Moreover, I am
>>> not getting any compilation error and I can access the Ipopt class from
>>> Eclipse and the imports I do in my Java class which extends Ipopt works
>>> also fine.
>>>
>>> I have also checked the jipopt-3.2.2.jar file and it has indeed inside
>>> the org.coinor.Ipopt class. That is why I don't know exactly where could be
>>> the problem.
>>>
>>> Thank you very much again,
>>> Best regards,
>>>
>>> Alberto
>>>
>>
>>
>
>
>  --
> *--
> *
>
> *Mr Alberto Calzada
> Full-time PhD Candidate*
>
> *Room 16J25 *
>
> *School of Computing and Mathematics
> Faculty of Computing and Engineering*
>
> *University of Ulster at Jordanstown Campus
> Northern Ireland, UK
> Email: Calzada-A at email.ulster.ac.uk*
>
> *Tel:  +44 28 90361114 *
>
>
>


-- 
*--
*

*Mr Alberto Calzada
Full-time PhD Candidate*

*Room 16J25 *

*School of Computing and Mathematics
Faculty of Computing and Engineering*

*University of Ulster at Jordanstown Campus
Northern Ireland, UK
Email: Calzada-A at email.ulster.ac.uk*

*Tel:  +44 28 90361114 *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/ipopt/attachments/20130118/631b1696/attachment-0001.html>


More information about the Ipopt mailing list