Skip to content
Prev 105420 / 398506 Next

Quadratic Optimization

Unless I'm missing something, optimizing a linear function with 
quadratic constraints is almost trivial with Langrange multipliers. 

      Maximize a'x subject to x'Ax=c. 

      S = Lagrange objective = a'x+lam*(x'Ax-c). 
      dS/dx = a + 2*lam*Ax. 
     
      Given lam, x1 = solve(A, a)/(2*lam) 
        
      Then x = c*x1/(x'Ax) 

      In R, you need to know that "t" = transpose of a matrix. 

      I thought I had seen mention of a contributed package for 
optimization with nonlinear constraints.  However, you don't need that 
here. 

      In case this does not solve your problem, my crude engineer's 
approach to constrained optimization includes the following: 

      (1) Find transformation to send the constraints to +/-Inf. 

      (2) If that fails, add the constraints as a penalty.  Start with a 
low penalty and gradually increase it if necessary until you solve the 
problem.  Of course, to do this, you have to make sure your objective 
function returns valid numbers outside the constrained region. 

      How's this? 
      Spencer Graves
amit soni wrote: