Formulate an objective function with summation terms to solve a linear programming problem

21 次查看(过去 30 天)
I am trying to formulate the following problem
where the decision variables are and , are given matrices of length N and M respectively.
All i am interested in, is the formulation of the objective function to solve using linprog. If not possible using linprog,
how should i formulate it to solve using fmincon?

采纳的回答

John D'Errico
John D'Errico 2022-5-27
编辑:John D'Errico 2022-5-27
Why would you need fmincon on a purely linear problem?
u and v may be different vectors in your eyes, but they can trivially be combined into ONE vector. Call the unknown vector bauv, where you will pack it all into ONE unknown vector. That is, bauv=[b,a,u,v].
Now you just form the sum to minimize as a linear combination of the elements of bauv. So use of linprog will be nothing more complicated than your ability to create the correct matrices, both for the objective, and for the inequality constraint array, but nothing more.
(I know, your next question will be, but how do I do that????)
b is a scalar unknown.
a is an unknown vector, of length that you have not specified. That is, it appears you have said that the vectors xi are of length N. So if a is a vector, then it MUST be of length N.
At the same time, you claim that yi are also vectors, of length M. And therefore a MUST be of length M, itf you will form a dot product there too. So now a must be a vector of length both N and M. I'll assume that N MUST be the same as M for your problem to make any sense at all.
u is an unknown vector of length N.
v is therefore also a vector of length M = N.
So now you just pack it all together. In the linear programming problem, if X is the vector of unknowns, X = [b,a,u,v], then the objective is defined by a dot product with the vector f*X. Here f will be something like:
f = [0,zeros(1,N),ones(1,2*N)];
Remember that based on what you have said, this makes no sense unless N==M. Now just build up the constraints as you need them, and call linprog.
  3 个评论
Nick Varnas
Nick Varnas 2022-5-27
Hi John, let me make some more clarifications
1)
2) represents the i-th data point of a set of points called 'X'. x itself is a 100x2 matrix containing the x and y coordinates of each data point. Therefore, there are 100 data points with x and y coordinates.
3) represents the i-th data point of a set of points called 'Y'. y itself is a 100x2 matrix containing the x and y coordinates of each data point. Therefore, there are 100 data points with x and y coordinates.
4) Therefore yes you are correct N=M
My issue is the formulation of the vector of the objective function

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by