I’m solving the following multi-product pricing optimization problem:
maximize sum((1/beta1(i,j))*(beta0(i,j)*q(i,j) + entr(q(i,j))+ entr(1-sum(q(i,:))) + log(1-sum(q(i,:))))) \for all i & j
for j = 1:4
(q(i,j))^(1.1) <= q(i,j) <= (q(i,j))^(0.9);
(1-sum(q(i,:)))^1.1 <= (1-sum(q(i,:))) <= (1-sum(q(i,:)))^0.9;
0 <= q(i,j) <= 1; \for all i & j
The objective function is jointly concave in all q(i,j)'s. and the constraints are convex set. However, CVX completely ignores the constraints as if they don’t exist and produces the same opt_val as the if the problem were unconstrained. Also, worth mentioning there are warnings next to the scroller of the editor that states:" ‘<=’ produces a value that might be unused.".
I wonder what went wrong.
All feedback are highly welcome.
The MATLAB editor doesn’t “understand” CVX, so I wouldn’t worry about editor warnings on CVX code lines if it looks correct to you.
Are the constraints satisfied at the reported optimal solution? You haven’t provided your CVX code or a reproducible problem. But it is certainly possible that the addition of constraints to an unconstrained problem does not change the argmax and optimal objective value. If x = argmax of unconstrained problem, then adding constraints which x satisfies will result in a constrained problem having the same argmax and optimal objective value. I’m not saying that’s what’s going on in your case, or whether you have made some error in your CVX code.
Don’t use quiet option when you are trying to figure out what’s going on. I moved the ’ from the end of the beta 's to after the ] .
There seem to be some numerical difficulties, but the problem was reported as solved using sedum, sdpt3, both using the CVX successive approximation method. I also solved it using scs and ecos, which allow the problem to be solved under CVX 3.0beta without using the successive approximation method. All but ecos reported optimal objective value of about 263.774. Ecos resulted in optimal objective value of 634.568. I didn’t check whether any constraints are violated. Here are optimal q from sedumi and ecos. Optimal q from sdpt3 and scs are close to sedumi. I leave the checking to you.
Please remove the quiet option, and show us the solver output, optimal q, and tell us which constraints are violated (by more than solver tolerance).
Edit: I used ECOS 2.04. As can plainly be seen, the optimal q from ECOS has negative components which violate the constraint 0 <= q <= 1. So something is wrong with either CVX 3.0beta (which does have some bugs) or ECOS. The other solvers pretty much agree, so I leave it you to point out the constraint violation(s) by the returned optimal solution.
Sorry to bother you again.Can you show me your scs code?I have a problem that can only be solved by scs.But when I try scs with a simple probem,there are error messages as follows:
WARN: A->p (column pointers) not strictly increasing, column 0 empty
NaN + NaNi NaN + NaNi
NaN + NaNi NaN + NaNi.
I know you have already answer my question in another talk,but could you please show me your code and let me find out the solution?Thank you.
Have you tried running SCS 2.0.2 (examples in examples directory) directly under MATLAB without CVX? Does that work at all?
I think there must be some bug in some combination of CVX 3.0beta and SCS. I have run SCS 1.2.6. I don’t know of any reports of anyone having successfully used SCS 2.0.2 under CVX, but that doesn’t mean it hasn’t been done. With my combination of (old) compiler and MATLAB version, I never succeeded in making SCS 2.0.2, so I stuck with 1.2.6. Perhaps you could make SCS 1.2.6 https://github.com/cvxgrp/scs/releases/tag/v1.2.6 and see whether that works.
As for the code I ran in my post above, i didn’t retain it, but just copied and pasted the code from the preceding post, with the change described in my previous paragraph, plus use of cvx_solver scs.
Sorry to bother you again.I’ve tried SCS1.2.6. to solve a smaller scale of my problem,and it works well.But now I seem to meet some new problems when I try to solve the original problems.The constraints of the successfully solved problem is like this:
It seems that when matlab loaded the constraints,there will be the red lines.However,when I try the original problem,it shows:
Only a samll part of the constraints have red lines under them.Does this mean cvx only load the constraints who have red lines under them and all the other constraints are ignored?Also,there are about 10^6 equality constraints on single element as shown in the picture.Thanks a lot!
Those red lines (squiggles) look like they’re in the MATLAB editor. If so, I would ignore them because the MATLAB editor doesn’t understand CVX’s syntax.
I have no idea what your CVX program is, but are you explicitly listing all these individual constraints? It would be better to vectorize as much as possible, such as ave(81,24:74) == 0 , or whatever.
Also, if you are constraining a large number of elements of a large matrix to zero, and you already have memory challenges, at least with 2nd order solvers, maybe it would be better to build up the matrix, possibly as sparse, from “unwasted” variables, thereby reducing number of variables (elements) and constraints. Depending on the problem, that might reduce memory requirements a lot.
Also, if a matrix is required to be symmetric, it is better to declare is as such than to impose n*(n-1)/2 equality constraints to enforce it. If it is “almost” symmetric, maybe you can declare is symmetric, and add some other variables to the elements not required to be symmetric.