title: Maximize quadratic objective function subject to linear equality and inequality constraints in R
body: <p>I'm trying to find how to maximize quadratic function in R with both equality and inequality constraints:</p>
  
  <p>Maximize <code>x' * H * x</code><br>
  subject to:  <code>Aeq * x = beq</code><br>
  <code>A * x &gt;= b</code>
  and <code>x &gt;= 0</code></p>
  
  <p>A simplified version of the problem could be </p>
  
  <p>Maximize <code>x^2 + y^2</code><br>
  subject to <code>x + y = 1</code><br>
  and <code>x, y &gt;= 0</code>  </p>
  
  <p>Since this is a Maximization problem, I am unable to use <code>solve.QP</code> function in the <code>quadprog</code> package.</p>
  
  <p>I tried using <code>constrOptim</code> as well. But note that there is an equality constraint and <code>constrOptim</code> needs a initial guess in the interior of the feasible region. As a result <code>constrOptim</code> cannot be used for equality constraints.</p>
  
  <p>I tried using <code>auglag</code> in the <code>alabama</code> package too. But I don't seem to get the right answer to the maximization problem.</p>
  
  <p>Had the problem been a minimization problem, the answer to the simple problem is x = 0.5 and y = 0.5. Both <code>auglag</code> and <code>solve.QP</code> give me this answer.</p>
  
  <p>But I am looking for the solution to maximization problem. The answer by geometry would lie at (x = 1 and y = 0) OR (x = 0 and y = 1).</p>