Optimization problem with integer variables
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Aviram Zilberman
am 29 Mär. 2017
Kommentiert: Aviram Zilberman
am 31 Mär. 2017
I have a nXn matrix M of integers with values 1...k. All the occurrences of values in M can be counted using hist(). My constraint is as follows : non of the occurrences of each value in M should not exceed a certain bound c. How do I define such constraint using intlinprog ?
0 Kommentare
Akzeptierte Antwort
Torsten
am 29 Mär. 2017
Let x(i,j,l) (1<=i,j<=n, 1<=l<=k) a binary variable which is 1 if the element at position (i,j) equals l, 0 else.
Then the constraints are
sum_i sum_j x(i,j,l) <= c for 1<=l<=k
0 <= x(i,j,l) <= 1
x(i,j,l) integer.
Best wishes
Torsten.
3 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Linear Programming and Mixed-Integer Linear Programming finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!