pygmo2 icon indicating copy to clipboard operation
pygmo2 copied to clipboard

Non linear constraints detected - but no nonlinear constraints?

Open optiluca opened this issue 4 years ago • 2 comments

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):

  • OS: Windows
  • Installation method: Conda
  • Version: 2.15

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!

optiluca avatar Sep 25 '20 20:09 optiluca

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)

darioizzo avatar Sep 26 '20 11:09 darioizzo

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!

optiluca avatar Sep 28 '20 07:09 optiluca

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

122941346 avatar Apr 23 '24 20:04 122941346