Finding variables using a simple optimization (maybe linear programming)

조회 수: 1 (최근 30일)
Rengin
Rengin 2016년 3월 31일
댓글: Rengin 2016년 3월 31일
% Dear Users,
% I have three equatians as below:
A = x(1)s(11)+x(2)s(12)...+x(n)x(1n)
B = x(1)s(21)+x(2)s(22)...+x(n)x(2n)
C = x(1)s(31)+x(2)s(32)...+x(n)x(3n)
% I know the values of (A,B,C) and all 's' variables
% Additionally all 'x' variables have upper and lower bands (I know also those values) such as:
a1<=x1<=b1
a2<=x2<=b2
a3<=x3<=b3
...
an<=xn<=bn
Is there any way to find (x1, x2,...xn) values with the information above. Please don't send me the related page about "linprog". I tried to implement it but I failed to realize objective and all 'x' variables took the values of lower bands.
Thanks a lot!

답변 (1개)

Alan Weiss
Alan Weiss 2016년 3월 31일
You have three equations and n unknowns x1, ..., xn. In general you will have an n - 3 dimensional set of variables that satisfy all the conditions, if there are any solutions at all.
If you want a unique solution, give a linear objective function such as minimizing sum(x(i)) and solve it using the linprog function from Optimization Toolbox. If you want to find the set of all solutions, I suppose that you could give a bunch of different objectives, then take the convex hull of the resulting set.
Alan Weiss
MATLAB mathematical toolbox documentation
  댓글 수: 1
Rengin
Rengin 2016년 3월 31일
% Thank you Mr. Weiss, I will have some extra questions
% For the equations below, should I use Aeq=[s(11) s(12)...s(1n);s(21)...;s(31)...] and beq=[A;B;C]
A = x(1)s(11)+x(2)s(12)...+x(n)s(1n)
B = x(1)s(21)+x(2)s(22)...+x(n)s(2n)
C = x(1)s(31)+x(2)s(32)...+x(n)s(3n)
% OR should I consider the equations above as inequalities
And my objective could be as your recommendation as below:
Objective=min (x(1)+x(2)+...x(n)). Am I right?

댓글을 달려면 로그인하십시오.

카테고리

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