Constraint Optimization: argmin dot product between two vectors

21 次查看(过去 30 天)
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 个评论
Murali Krishna AG
Murali Krishna AG 2020-11-28
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
Walter Roberson 2020-11-28
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.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2019-3-29
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 个评论
ickarus
ickarus 2019-3-29
Thanks you a lot for your answer! I have a little question...
Why you set upper bound as ub=v.*ones(size(x)) and not ub=v ?
Thank you very much!
Walter Roberson
Walter Roberson 2019-3-29
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]

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by