I am using scipy differential evolution. I have to set the following linear constraints. 0<x1+x2+x3+x4<=1. x2+x3=1. I have set the following matrix A=[0 1 1 0] B=[1]. linear_constraint = LinearConstraint(A,B,B,True). i have also set lower and upper bound to 0 and1. However, during each iteration, the output of the objective function is InF, whereas the differential evolution is not calling the objective function
Can anyone suggest what is wrong? My Scipy version is 1.5.4 and python 3.7.
Thanks in advances..
You need to set up the constraints as:
The
keep_feasible
keyword will be ignored. For the constraints to be feasible the bounds on each of the parameters have to encompass a feasible region. For example ifx2
andx3
are positive then one ofx1
orx4
has to be able to access negative values.In a constrained minimization the objective function is only evaluated if the trial solution is not feasible.
A trial solution is accepted if: