title: How to eliminate error DCP from library CVXR?
body: <p>I tried to create simple model of portfolio with short-sales, using CVXR package. Below is well-known objective function (expected return minus sd of expected return with known teta). But R returns this: <em>&quot;Error in construct_intermediate_chain(object, candidate_solvers, gp = gp) : Problem does not follow DCP rules.&quot;</em> I tried to fix this in code below, but nothing was useful. Also, this type of obj function is concave. Also, it is easy to make convex function and find min. Error does not disappear in this case too. Please, could you explain where is the error and maybe what's the possible solution.</p>
  <pre><code>library(CVXR)
  n = 3
  w = Variable(n)
  c = matrix(1, nrow = 3, ncol = 3)
  mu = matrix(1, ncol = 3, nrow = 1)
  
  m1 = rnorm(100)
  m2 = rnorm(100)
  m3 = rnorm(100)
  mu[1, 1] = mean(m1)
  mu[1, 2] = mean(m2)
  mu[1, 3] = mean(m3)
  
  c[1, 2] = cov(m1, m2)
  c[1, 3] = cov(m1, m3)
  c[2, 1] = cov(m1, m2)
  c[2, 3] = cov(m2, m3)
  c[3, 1] = cov(m1, m3)
  c[3, 2] = cov(m2, m3)
  c[1, 1] = cov(m1, m1)
  c[2, 2] = cov(m2, m2)
  c[3, 3] = cov(m3, m3)
  
  teta = 0.5
  obj1 =  mu %*% w - teta * sqrt(quad_form(w, c))
  constr &lt;- list(sum(w) == 1)
  pro &lt;- Problem(Maximize((obj)), constr)
  sol &lt;- solve(pro)
  sol$w
  </code></pre>