Too many output arguments

clear; close all; clc;
n_nodes = 6;
n_edges = 7;

e = zeros(n_nodes,1);
e(1) = 1;
e(n_nodes) = -1;

A= [1 1 1 0 0 0 0 ;
-1 0 0 1 0 0 0 ;
0 0 -1 0 1 0 0 ;
0 0 0 -1 0 1 0 ;
0 0 0 0 -1 0 1 ;
0 0 0 0 0 -1 -1];

d = [3;2;4;4;1;1;3];

C=[eye(7) zeros(7,1)];
b=zeros(8,1);
b(8)=1;

cvx_begin

variable alfa1(7);
variable alfa2(7);
variable v(6);

minimize (d)'*alfa2;
subject to
    -b'+(alfa2-alfa1)'*C+v'*(A*C-e*b') == 0;
    -alfa1 <= 0;
    -alfa2 <= 0;

cvx_end

My code is as shown above. I get the error

Error using minimize
Too many output arguments.

Error in (line 15)
minimize (d)’*alfa2; .

Any ideas what could be causing the error? I am trying to solve the lagrange dual of an optimization problem.

Thanks in advance!

Put the objective function inside () .I.e., move the closing parenthesis to the end of the objective function.
minimize (d'*alfa2)

1 Like

Thanks! That worked :slight_smile: