fmincon constrain a row to be fixed

1 visualización (últimos 30 días)
AMIT PAWAR
AMIT PAWAR el 26 de Abr. de 2020
Comentada: AMIT PAWAR el 26 de Abr. de 2020
rng(4)
St = transpose(rand(9,10))
Stplus1 = transpose(rand(9,10))
fun = @(x) norm(transpose(St*x - Stplus1)*(St*x - Stplus1));
x0 = rand(9,9);
lb = zeros(1,81);
ub = ones(1,81)*0.999999;
A = [];
b = [];
Aeq = []
beq = []
nonlcon = [];
options = optimoptions(@fmincon,'MaxFunctionEvaluations',10000)
x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon, options);
I am trying to minimize the function 'fun' with respect to argument x. I wanted to know if there is a way to set one row of x to be fixed with some constant values while using fmincon.

Respuesta aceptada

Matt J
Matt J el 26 de Abr. de 2020
Editada: Matt J el 26 de Abr. de 2020
Yes, you can simply not treat them as unknowns. Instead, rewrite the problem in terms of a smaller matrix z containing the unknown elements only. So, for example, if it is the first row x(1,:) is some known row-vector v, youwill solve for the matrix z=x(2:end,:) and your objective will reduce to,
A=St(:,2:end);
B=Stplus1-St(:,1)*v;
fun = @(z) norm(A*z-B,'fro').^2; %z=x(2:end,:)
Incidentally, your problem is a linear least squares optimization, so it would be sufficient to use lsqlin rather than fmincon.

Más respuestas (0)

Categorías

Más información sobre Linear Least Squares en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by