Python scipy.optimize gives wrong answer, how to deal with semidefinite positive condition?
The goal is to calculate an optimization problem using python scipy.optimize.
Suppose C is a given 4-dimension matrix (in the code I use a random matrix to denote that). The optimized variables are A0 and B0 which are 2-dimension symmetric matrices. The constraints are I+A0, I-A0, I+B0, I-B0 are semidefinite positive, where I is 2-dimension identity matrix. The objective function is max Tr((A0 ⊗ B0)C), where ⊗ is the Kronecker Product.
Why “if” can’t be used in Scipy.optimize Inequality Constraint?
Consider a simple question using Scipy.optimize: Maximize(xy) s.t x^2+y^2=200. The right code is this :
Scipy Minimize Not Varying Optimization Variables as Supposed to
I am trying to optimize for a given date of deposit and withdrawal of a given commodity in a storage considering that the storage max capacity is 50 and the rate of injection/withdrawal is 5/day. Assume that it costs 0.01 per month to store the commodity. My commodity prices list is equally spaced in monthly dates.
At first I want to try to optimize for a single injection and withdrawn and next extend for multiples injections and withdrawns for the given timeframe i am analyzing.