필터 지우기
필터 지우기

Intlinprog - add another constraint

조회 수: 2 (최근 30일)
Christian Schumacher
Christian Schumacher 2019년 3월 30일
편집: Matt J 2019년 3월 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