Dear friends ,I want to solve a very simple problem,iBut no matter how I change the value of a, the x I get is the same?

clear all;
clc;

cvx_begin
% cvx_solver mosek

variable a(15,1)
variable sumi
expressions test(15,1)
max(sumi)
subject to
sum(a) == 1;
test = [11;1;1;1;1;1;1;1;1;1;1;1;1;1;1];
a >= 1e-5;
% max(test)-0.01 <= sumi
sumi <= sum(test.*a);
cvx_end

Calling SDPT3 4.0: 15 variables, 1 equality constraints

num. of constraints = 1
dim. of linear var = 15


SDPT3: Infeasible path-following algorithms


version predcorr gam expon scale_data
NT 1 0.000 1 0
it pstep dstep pinfeas dinfeas gap prim-obj dual-obj cputime

0|0.000|0.000|7.5e+01|3.9e+01|1.5e+03| 0.000000e+00 0.000000e+00| 0:0:00| chol 1 1
1|0.996|1.000|2.7e-01|1.0e-01|1.5e+01| 0.000000e+00 -9.839838e+00| 0:0:00| chol 1 1
2|1.000|1.000|8.1e-08|1.0e-02|1.3e+00| 0.000000e+00 -1.344139e+00| 0:0:00| chol 1 1
3|1.000|0.989|2.0e-08|1.1e-03|1.5e-02| 0.000000e+00 -1.439579e-02| 0:0:00| chol 1 1
4|1.000|0.989|6.7e-09|1.1e-04|1.6e-04| 0.000000e+00 -1.326531e-04| 0:0:00| chol 1 1
5|1.000|0.989|1.7e-10|1.1e-05|1.8e-06| 0.000000e+00 1.095463e-06| 0:0:00| chol 1 1
6|1.000|1.000|1.3e-11|3.6e-11|1.9e-08| 0.000000e+00 -1.948175e-08| 0:0:00| chol 1 1
7|1.000|0.999|1.1e-13|2.6e-12|2.1e-10| 0.000000e+00 -2.124443e-10| 0:0:00|
stop: max(relative gap, infeasibilities) < 1.49e-08

number of iterations = 7
primal objective value = 0.00000000e+00
dual objective value = -2.12444349e-10
gap := trace(XZ) = 2.13e-10
relative gap = 2.13e-10
actual relative gap = 2.12e-10
rel. primal infeas (scaled problem) = 1.13e-13
rel. dual " " " = 2.65e-12
rel. primal infeas (unscaled problem) = 0.00e+00
rel. dual " " " = 0.00e+00
norm(X), norm(y), norm(Z) = 2.6e-01, 2.1e-10, 8.3e-10
norm(A), norm(b), norm(C) = 4.9e+00, 2.0e+00, 1.0e+00
Total CPU time (secs) = 0.25
CPU time per iteration = 0.04
termination code = 0
DIMACS: 1.1e-13 0.0e+00 2.6e-12 0.0e+00 2.1e-10 2.1e-10


Status: Solved
Optimal value (cvx_optval): +0

You probably want to maximize sumi and not max(sumi) which is just an expression that doesn’t do anything interesting. Right now you have a feasibility problem, without objective.

Thank you so much, I solved this problem

Following up in @Michal_Adamaszek 's post: max(sumi) is sumi, because sumi is a scalar. Therefore, all max(sumi) will do is print out
cvx real affine expression (scalar). So other than causing that to be printed, it does absolutely nothing

BYW, if you get confused in the other direction, and use maximize or minimize outside of cvx_begin ... cvx_end, you may get an error message such as
Undefined function 'maximize' for input arguments of type 'char'. .

Thank you very much, I changed ‘max ’ to ‘ maximize’ and got a reasonable solution