Formulate linear programming problem

1 次查看(过去 30 天)
I need help using either the linprog or intlinprog function. Suppose a person dies and you have to split what this person owns between his two sons in a fair way. The person owned 14 objects, each worth a certain amount, in total 183000$. How can I formulate this with LP to find the partition that minimizes the difference between the values of the two parts?
Or in other words, minimize the inheritance assigned to one of the brothers with the constraint that it should not be less than the sum of all objects divided by 2.

回答(2 个)

John D'Errico
John D'Errico 2017-4-14
Can you use linprog? If you split an item 60-40, would that be acceptable? If not, then linprog is not possible.
This is essentially a binary integer linear programming problem. Use intlinprog, with INTEGER variables (vector x) from the set [0,1].
So minimize the product f*x, such that f*x>=sum(f)/2.
To be honest, it is just as easy to use exhaustive enumeration here. All possible sets are given by
dec2bin(0:2^14-1) - '0'
Choose the row that satisfies your goal, which will require all of one matrix*vector multiply, followed by a quick test.
This seems too much probably homework though, so I'll go no further.

Alan Weiss
Alan Weiss 2017-4-14
I think that you can formulate this as an integer problem. Let each object be either assigned a +1 to mean it goes to son A, or a 0 to mean it goes to son B. Set a linear inequality that the total value to son A is at least half the total value, and set an objective function to minimize the value that son A gets. At least, I think that this will solve the problem.
Alan Weiss
MATLAB mathematical toolbox documentation

类别

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