Intlinprog - add another constraint

1 次查看(过去 30 天)
Hello,
I need some help with an optimization problem, which I am programming in the last few days. I already asked a general question, which helped me a lot, and I was able to program most of my optimization problem. Here is the link for the other question:
The problem I have now, is as follows: I have three columns (Name, Value 1, Value 2) which are optimizied, to yield a maximum sum for column 2, while staying under the sum of 50.000 in column 3. The outcome of the problem are 8 names from column one.
I know want to add categories to the names. I have five categories for the 200 Names.(category 1,2,3,4 or 5). Every name is assigned in one or two categories. I now want to have an optimal solution for my problem, while at least one of the eight names is from every category.
I looked into the documentation, but wasn't able to find a possibility to add the constraint to my problem. Does anyone has an (simple)idea to solve this problem? I am looking forward to your answers!

采纳的回答

Matt J
Matt J 2019-3-30
编辑:Matt J 2019-3-30
You need to construct a 5x200 binary matrix M such that M(i,j)=1 if the j-th name belongs to the i-th category. Your 200x1 binary design vector x must then satisfy the constraints
M*x>=ones(5,1)
You would add this to whatever constraints you had previously.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with Optimization Toolbox 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by