Finding variables using a simple optimization (maybe linear programming)

1 view (last 30 days)
Rengin
Rengin on 31 Mar 2016
Commented: Rengin on 31 Mar 2016
% 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!

Answers (1)

Alan Weiss
Alan Weiss on 31 Mar 2016
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 Comment
Rengin
Rengin on 31 Mar 2016
% 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?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by