pmelchior / proxmin

Proximal optimization in pure python
MIT License
113 stars 24 forks source link

How to add equality constraints in your algorithm? #24

Closed machanic closed 3 years ago

machanic commented 3 years ago

I have two equality equation constraints in my problem, all of which are quadratic equation. How to add them in the bSDMM method. I check your example. Is the argument prox for the constraint ?? (defined in https://github.com/pmelchior/proxmin/blob/master/examples/parabola.py#L30)

How to add my constraints, my objective function are convex function. Can you give me an example?

pmelchior commented 3 years ago

You need to formulate the constraints as proximal operators. That's the argument prox for the algorithms in this package.

machanic commented 3 years ago

@pmelchior I check the README file.

def prox_circle(X, step):
    """Projection onto circle"""
    center = np.array([0,0])
    dX = X - center
    # exclude everything other than perimeter of circle
    phi = np.arctan2(dX[1], dX[0])
    return center + radius*np.array([np.cos(phi), np.sin(phi)])

Is this the constraint equation? How to set the gradient/derivative formula of the constraint? Which argument? Can you show me an example?

machanic commented 3 years ago

Does the formula of the proximal operators the same formula form with the constrained formula??

machanic commented 3 years ago

Please help me, I am stuck in my research at the constraint problem, I will cite your paper. The scipy source code file of my objective function and constraint are in the attachment. But Scipy runs too slow! (30 [minutes) Can you help me.

scipy_find_tangent_point.zip

pmelchior commented 3 years ago

SLSQP would be my first approach here. However, if you want to convert to a proximal formulation, I recommend reading up on proximal operators and algorithms, e.g. in Parikh & Boyd 2014.