Currently, I am working on an unconstrained energy minimization function, but I need to add some constraints. My system is a 2D lattice with a force applied to it, and I want the sides to be able to move, but the length of each side to be constant.

I know that using a Lagrange multiplier could make the terms I want to stay constant, constant by making the energy cost so huge that it won't move anything. But I was wondering if there was a different way to add constraints to the system without changing the fact that the energy minimization is unconstrained.

  • $\begingroup$ More like I want to add parameters to the unconstrained minimization. $\endgroup$ Commented Jun 16, 2015 at 16:10
  • $\begingroup$ In the lattice, there are nodes and bonds that connect them. A force is applied at the top and the lattice is allowed to have it's bonds stretch or bend. I want to make it so the bonds along only the sides cannot change length. I cannot simply let dx=dy=0 nor sqrt(dx^2 + dy^2)=0 because the bending energy has mixed terms. $\endgroup$ Commented Jun 16, 2015 at 16:27
  • $\begingroup$ What about using a penalty method? $\endgroup$
    – nicoguaro
    Commented Jun 16, 2015 at 20:34
  • 2
    $\begingroup$ In addition to using penalty methods as @nicoguaro suggests, you could also transform the degrees of freedom to a different representation, such as bond angle + bond length rather than absolute position. A simpler case to try first would be the double pendulum, then the n-pendulum, then the full lattice. I think there are some helpful examples in Goldstein's classical mechanics book, or Hand and Finch Analytical Mechanics. $\endgroup$ Commented Jun 16, 2015 at 20:57
  • $\begingroup$ Why do you want to avoid multipliers? $\endgroup$
    – Bill Barth
    Commented Jun 16, 2015 at 23:25

1 Answer 1


You want to convert a constrained problem into an unconstrained problem. There are two general techniques for this:

  • If you have a constraint of the form $g(x_1,...,x_N)=0$, then you may be able to write it as $x_N=f(x_1,...,x_{N-1})$ and thereby simply eliminate one of the variables from your problem. You then don't need the constraint any more. (Of course, it may be that your constraint doesn't allow you to eliminate $x_N$ but another variable, with the same result.)

  • You can augment your objective function by a penalty term that corresponds to your constraint. For equality constraints, this is most often done using a quadratic penalty, whereas for inequality constraints one most often uses a logarithmic penalty term. I would advise you to read through the book by Nocedal and Wright on "Numerical Optimization" to see how this works.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.