Clear Filters
Clear Filters

Intlinprog - add another constraint

2 views (last 30 days)
Christian Schumacher
Christian Schumacher on 30 Mar 2019
Edited: Matt J on 30 Mar 2019
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!

Accepted Answer

Matt J
Matt J on 30 Mar 2019
Edited: Matt J on 30 Mar 2019
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.

More Answers (0)

Categories

Find more on Get Started with Optimization Toolbox in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!