Strongly non-negative constraint scipy minimizes

I am trying to use the minify function from scipy to fit a curve.

I have a 4-parameter equation with constraint constraints for each one and I would like to add a constraint that param1 is different from param2 (and if possible param2> param1). From what I understood, I have to use scipy.optimize.minimize with constraints and constraints. But constraints can only be equality (up to 0) or inequality (non-negative,> = 0).

So, if I set a constraint function to this (params are the store in an array):

cons = {"type": "ineq", "fun": lambda x: x[1] - x[0]}

      

in the case when x [1] and x [0] are equal, the inequality constraint does not apply. In fact, I don't quite understand why there is no "strictly positive" constraint ...

A workaround might be to add a very small remainder to this "p [1] - p [0]", but there is no cleanest solution

Greetings

+3
python scipy minimize


source to share


No one has answered this question yet

Check out similar questions:

3
scipy.optimize.minimize (COBYLA and SLSQP) ignores constraints triggered inside the loop
1
Error in solving nonlinear optimization system with dynamic constraint using openopt and scipy
1
SciPy.optimize.minimize SLSQP ignores ratings and limits
1
Complex minimization of constrained nonlinear functions with scipy.optimize.minimize
1
Ineq and eq constraints with scipy.optimize.minimize ()
0
(Python) Scipy Minimize: Multiple Variable Lists
0
Linprog optimization for Python SciPy failed with status 3
0
Python SLSQP to minimize the use of extra parameters
0
minimize the inequality constraint function
0
lower and upper bounds in python, scipy minim



All Articles
Loading...
X
Show
Funny
Dev
Pics