esa / pygmo2

A Python platform to perform parallel computations of optimisation tasks (global and local) via the asynchronous generalized island model.
https://esa.github.io/pygmo2/
Mozilla Public License 2.0
422 stars 57 forks source link

Non linear constraints detected - but no nonlinear constraints? #61

Closed optiluca closed 10 months ago

optiluca commented 3 years ago

Describe the bug I've made an extremely minimal test problem which is multiobjective and has a dummy constraint. I get an error in the algorithm.evolve call, suggesting that my constraint is nonlinear, even though in this very simple example the constraint is in fact a constant!

To Reproduce https://gist.github.com/optiluca/d58f92de8c1560ecc8092994d592e452

File "pygmo2.py", line 62, in population = algorithm.evolve(population) ValueError: function: evolve where: C:\projects\pagmo2\src\algorithms\nspso.cpp, 104 what: Non linear constraints detected in <class 'main.TestProblem'> instance. NSPSO cannot deal with them.

Expected behavior I'd expect it to run

Environment (please complete the following information):

EDIT: Referring to this table https://esa.github.io/pygmo2/overview.html#heuristic-global-optimization, it seems that nspso doesn't support constrained optimisation at all. It seems like IHS might work, but switching to that throws this error:

Multiple objectives and non linear constraints detected in the <class 'main.TestProblem'> instance. IHS: Improved Harmony Search cannot deal with this type of problem.

Which of the available algorithms (if any!) is suitable for a M-C problem? Thanks!

darioizzo commented 3 years ago

Pagmo does not see the difference between linear and non linear constraints. All constraint are treated as non linear except the box bound constraints (lb and in). I agree the text message is receiving and probably should be changed to "constrained problem detected" ....

In pagmo there are no solvers that directly deal with multiobjective constrained problems. But you can always transform your problem in an unconstrained version (see the unconstrain class)

optiluca commented 3 years ago

I see. I'll have a play with the various methods on offer. Other than the somewhat misleading error message, the issue can be closed on my side. Grazie!

122941346 commented 3 months ago

感谢大佬的指点迷津,我的问题解决了。 Thanks to the big guy's guidance, my problem was solved.