I want to solve a nonlinear programming problem. The objective function is nonlinear and the constraints are linear. Given a vector α(dim is n*1)
, I want to find another vector θ( dim also is n*1)
make cos(α, θ) minimize. Meanwhile the θ
has some constraints. the constraint is A.dot(θ) < 0
(zero is a column vector),A dim is m*n
, m < n
.
The problem is, Given α(dim is n*1)
,A dim is m*n
, m < n
minimize cos(α, θ) = α^T.dot(θ) /(|α||θ|)
subject to
A.dot(θ) < 0 (zero dim m*1)
I have tried to use scipy.optimize.minimize to solve the problem and input the constraints. like
scipy.optimize.minimize(method='SLSQP', constraints=cons)
scipy.optimize.minimize(method='COBYLA', constraints=cons)
The result of the methods are depending on the initial value. I don't know how to get a reasonable initial value so I set initial value is random. As expected, the method gives a wrong result, the results don't meet the constraints.