I have faced a similar problem like you. But the elements of C matrix in my code are all functions of other field variables, like C(i,j) = Cij(m,n), here m and n are known field variables. And I use
func C=[ [C11,C12],[C21,C22] ];
to define C, but the same error of yours appears.
Could you please lend me a hand with this? Thank you very much.
would you help me out with the similar problem? the short description is presented in this discussion part.
And by the way, the varf equation I use is written in a very long formate and it takes a very long time to finish the computation of matrix A=equ(Th,Th).
I want to retrive its matrix calculation form to speed up it. Could you also give me some suggestions on how to speed up the process?
You cannot use a func, use a macro instead.
For speeding up your program, just use PETSc, see one of the many examples + this tutorial.
Basically, replace
My problem is a constrained non-linear problem, It works well using IPOPT provided in FreeFem++.
But I have not found the parallel version of IPOPT in FreeFem++ so it take a very long time in sequence form, especially the formation of matrix HJ .
Now I have exactly the form of J, DJ and HJ, can my problem be able to transformed using PETSc? Can you give me a general guideline for this transform process?
Sure! You can use Tao, the Toolkit for Advanced Optimization, which is part of PETSc. The interface ressembles what you’d do with Ipopt, but of course, everything is parallel
You can have a look at one of these examples [1,2,3]. Also, example12.edp from this tutorial.
The output massege always prints “Solver terminated: -6 Line Search Failure” after several iterations. Does it mean the solving process is unsuccessful? If so, what should I do to make the line search successful?
Where can I found the detail explaination of the meaning of some functions like “changeNumbering”? I am not sure my guess is ture or not. This makes me confused on retrieving the desired global field variables.
My own problem is a little bit different from normal constrained nonlinear optimization, DJ is not the direct partial derivative of J and can not form a exact corresponding J. In my original IPOPT code, I must turn off the linesearch function (with the code “linesearch=false” in IPOPT) to get the results or it will trapped in an endless line search process. How should I deal with this problem with TAO?
sorry, there was a bug in minimal-surface-Tao-2d-PETSc.edp, I fixed it in this commit. With quasi-Newton, you should now get Solver terminated: -2 Maximum Iterations, and with Newton Solution converged: ||g(X)|| <= gatol.
please have a look a section 8 of this tutorial. Also, you can start with a sequential example, and we’ll parallelize it afterwards. There is no need to bother with more than one process in the beginning.
you can try one of these methods, surely all of them don’t do linesearch. If you formulate exactly your problem, I may gave you a better answer.
The problem I want to solve is provided in Original_Ipopt.edp. It is a simplified bound constrained-nonlinear-time dependent-multiple variable problem. It works fine using IPOPT. But I have not found a TAO example that meet all the requirement I need. So I tried to rewrite it using TAO as in TAO_test.edp.
In the TAO_test.edp I uploaded, an error is encountered in the line 28 as createMat(Th, H, Pk);
The message says that “meshN The Identifier meshN does not exist”. How to correct it?
Could you please point out the incorrect parts in the TAO_test.edp and give me your valuable suggestions on how to correct them?
Sorry, you need to add buildDmesh(Th) after the plot line 21. Then, Th will be distributed and both createMat and createPartition will work as expected.
It works! And the results seem to be the same as the Ipopt one I uploaded and the speed is extremely fast!
Thank you very much!
Do you have a full tutorial for the TAO in FreeFem++ to explain the functions like “createPartition”? The “Miscellaneous” part is FreeFem++ Doc is not clear enough for me when compared with explaination of IPOPT.
Tutorial about FreeFEM + parallelism is available there, section 8, read the PDF about PETSc, there are some explanation. If something is not clear, please let me know.
List of Tao solvers are available there, if you see something you like that is not interfaced yet in FreeFEM, please let me know.
I have implemented my complete problem using TAO, but the due to I can not find a correct optimizing function J for my DJ and HJ, almost each Newton iteration needs very long CG iteration computing J and DJ and can not reach convergence.
In my original IPOPT program, I turned off the linesearch function and the J and DJ would be computed only once in each Newton iteration. In FreeFem++4.6 doc, it says that when linesearch is turned off, the method becomes a standard Newton algorithm instead of a primal-dual system(as in page 234). Would you please give me some suggestions on how to achieve this using TAO? I have tried all the possible TAO solvers for bound-constrained nonlinear problem and the problem continue to show up.
I also tried the SNESSolve in PETSc, since it do not need a J. But I have questions on the meaning of parameters bPETSc and xPETSc in the SNESSolve implement line below:
It seems bPETSc is the initial value and xPETSc is the output, but I found that before entering SNESSolve, some use xPETSc=bPETSc, some use xPETSc=0 and some use xPETSc=0.1 in the provided examples using SNESSolve. Even for the same example, xPETSc=0.1 and xPETSc=0.2 would leads to different solutions. So would you please also tell me the exact meaning of this two parameters and their values? And by the way, the boundary condition is applied using the same way as TAO in a bound-constrained form, is this correct in SNESSolve or must be applied in the varf form?