Search code examples
pythonoptimizationcvxpyconvex-optimization

Constraints for Rotor Balancing Problem with CVXPY


I am a machinery engineer with minimum background on math. I was tempted to use CVXPY to write a simple code about rotor balancing problem. It was amazing how simple and robust it works. My problem was as follows:


After getting user input for a matrix ALPHA(M,N) and A(M,1)

W=cvxpy.Variable((N,1),complex=True)    
objective2=cvxpy.Minimize(cvxpy.norm((ALPHA*W+A),"inf"))
prob2.solve()

W is complex, as it returns the weights and its angle for each N plane that balance the rotor.

My question is how to put a constraint on W. For instance, how to make sure W is less than certain value for each N plane?


Solution

  • After getting a user input for constraint masses matrix wc(N,1) the following code seemed to do the trick:

    const=[]
    const +=   [cp.norm(W2[i])<=wc[i]for i in range (N) ]
    prob3=cp.Problem(objective2,const)
    prob3.solve()