Constraint Optimization: argmin dot product between two vectors
18 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
ickarus
el 29 de Mzo. de 2019
Comentada: Walter Roberson
el 28 de Nov. de 2020
I'm trying to solve this optimization problem
Find vector y given two constraints (box constraint and equality constraint over y) and a vector x that minimize the scalar product between them.
Is there a MATLAB function that performes this optimization? I read about fmincon(fun,y,[],[],Aeq,beq,lb,ub) but i don't understand if and how i can set scalar product in fun parameter and if it solves my problem.
Thank you very much in advance!
EDIT: x is known
4 comentarios
Murali Krishna AG
el 28 de Nov. de 2020
Hi, I need help on this.
u=argmin{||X-A*w-B*v||^2} with no constraints
Inputs : A,B,X,w,v matrices
outputs:u which contain optimized vector of w,v.
I knew that i have to use fminunc ,how to write code using this.Please help me
Walter Roberson
el 28 de Nov. de 2020
Inputs : A,B,X,w,v matrices
But those are all the variables involved in the equations, so there are no parameters to be found ??
outputs:u which contain optimized vector of w,v.
?? I think you are going to need to explain more clearly.
You should open your own Question on this matter.
Respuesta aceptada
Walter Roberson
el 29 de Mzo. de 2019
In the below, the A is exactly the same as in your Ay=b constraint, and the b is exactly the same as in that constraint. Typically A and b are used for linear inequality constraints rather than linear equality.
x = .... as appropriate
A = .... as appropriate, your linear equality matrix
b = .... as appropriate, your rhs of your linear equality
Aineq = []; bineq = []; %linear inequalities are not being used here
lb = zeros(size(x)); ub = v .* ones(size(x)); 0 <= y <= v
[y, fval] = fmincon(@(y) dot(x,y), Aineq, bineq, A, b, lb, ub);
2 comentarios
Walter Roberson
el 29 de Mzo. de 2019
v is potentially a scalar. If you set an upper bound to a scalar, then instead of copying that scalar for the locations not specifically set, MATLAB would use +inf for the bound for those locations. Using v .* ones(size(x)) creates an array of 1's the same size as x and multiplies it by v, which gives you an array result. It makes the difference between (say) [7 inf inf] and 7*[1 1 1] = [7 7 7]
Más respuestas (0)
Ver también
Categorías
Más información sobre Solver Outputs and Iterative Display 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!