2020年12月19日星期六

CVXPY set Z to 1 if B is positive

So here's the problem. I have this variable Z which follows the following rule:

if loan j has a positive balance at time t Z = 1, otherwise Z = 0

I'm guessing Z should be defined as so:

Z = cvxpy.Variable(shape=shape_j_t, name="Z", boolean=True)  

So Z is constrained(?) to the balance "B". How do I inform the solver that Z should be 1 if B is positive and 0 otherwise? Especially given that B itself is composed of other cvxpy.Variables.



from Recent Questions - Stack Overflow https://stackoverflow.com/questions/65376942/cvxpy-set-z-to-1-if-b-is-positive Breedly

没有评论:

发表评论