# 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

## 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