My objective function is \sum_{i = 1}^n t_i \left(a (\frac{d_i}{t_i})^2 + b(\frac{d_i}{t_i}) + c\right)
and the constraints are just linear inequality constraints.
I am having quite some trouble to implement this function. Below is a minimal example of where I am at now. The error I get is “Cannot perform the operation {convex}*{convex}”. Note that d is strictly positive (and thus ‘t’ will be as well)
EDIT: a,b,c are always stricly positive as well
a = 2; b = 3; c = 4;
n = 10;
d = 1+rand(n,1);
cvx_begin
variable t(n);
minimize(pos(t).' * (a*pow_pos(d.*inv_pos(t),2)+b*(d.*inv_pos(t))+c));
subject to
t*0.1 <= d;
d <= t*10;
cvx_end
Any suggestions on how to improve the code are welcome as well. The object function looks as if it could be written down in a better way, but this was the best I could do so far.
It is always easy to blame the user. Are you sure the documentation suffices? For instance: the search function of the user manual does not work properly, i.e., no results are returned. Going through the pdf did not help me to find the answer. Not trying to offend, it’s typically a two way street…
I appreciate the feedback. I would direct you to this section of the documentation, in the introduction. I maintain that attempts to use CVX without understanding this section will inevitably lead to frustration.