I haven’t used CVX in a while, so sorry if this question is basic.
I would like to define, say, a polynomial function p=c_1x_1^2+c_2x_1x_2+c_3x_2^3, where the c_i's are decision variables, but the x_i's are not. I then need access to point evaluations of this polynomial, which would be linear expressions in the coefficients c_i. For example, I want to impose a constraint p(1,2)>5. How do you do this?
The comment section doesn’t seem to give me enough space, so I respond to mcg’s comment here:
Not sure if I completely understand the comment; I don’t want to write p in a separate function. Let me elaborate on my question. If I was doing this, e.g., in YALMIP, I would write:
sdpvar c_1 \ c_2\ c_3\ x_1 \ x_2
replace(p,[x_1,x_2],[1,2])>5 %this would be my constraint
Then, when calling the solver, I would let it know that the decision variables are c_1, c_2, c_3 (and not x_1 and x_2). So I am asking in CVX, (i) how do you distinguish between decision variables and indeterminate variables, and (ii) what is the analogue of the “replace” command above?
Perhaps there is no such special functionality and you are saying that I should use native MATLAB commands?
“I don’t want to write p in a separate function.” I understand that. But it’s an exercise: if you can express what you’re trying to do with a standard MATLAB function, it will show you how to do it in CVX. CVX does not have an equivalent to YALMIP’s “replace” function, or indeterminate variables.
Is there a fundamental reason why CVX chooses not to allow indeterminate variables? (They can often make the code much shorter. Consider, e.g., something as simple as fitting a polynomial function to data.)