Function optimizing matrix under the constraints (vector)

I'm having problem with finding a function that optimizes a matrix under specific constraints. In my task I have two matrices (K and C) of the same dimensions (SxP).The K matrix has test results in the range of 0 to 10 while Matrix c is a zero-one matrix, selecting the best result in the matrix K. The C matrix has two constraints:
a)
Where SP is the vector representing the maximum number of selected results in a given row
b)
My main task is to choose the best results in the matrix:

回答 (1 件)

Matt J
Matt J 2017 年 5 月 17 日
編集済み: Matt J 2017 年 5 月 17 日

0 投票

Once you have your objective and constraints expressed as matrix-vector multiplications, the problem is a straightforward application of intlinprog().
Summation along columns of C can be expressed as a matrix-vector multiplication A*C(:) where A=kron(eye(S),ones(1,P)). Summation along rows can be expressed the same way with A=kron(ones(1,S),eye(P)). The double summation for Q can be epxressed can be expressed K(:).'(C(:)).

2 件のコメント

Jan Dzban
Jan Dzban 2017 年 5 月 18 日
編集済み: Jan Dzban 2017 年 5 月 18 日
I don't understand the second part. Maybe on the example I will explain what I meant.
I have two matrices: The matrix K
and the matrix C:
and vector SP:
The C matrix has following constraints:
X11 + X12 + X13 <=1
X21 + X22 + X23 <=2
X11 + X21 <=1
X12 + X22 <=1
X13 + X23 <=1
x11 to x23 are binary
Now if i use a function intlinprog() i have
min (5x11 + 4x12 + 3x13 + 2x21 + 3x22 + 5x23)
f = [5 ;4 ;3 ;2 ;3 ;5]
intcon = 6
A = [1 1 1; 1 1 1]
b = [1;2]
And here is the problem because the number of columns in the matrix A doesn't match the number of elements in the vector f
Torsten
Torsten 2017 年 5 月 18 日
A = [1 1 1 0 0 0 ; 0 0 0 1 1 1]
Best wishes
Torsten.

サインインしてコメントする。

カテゴリ

質問済み:

2017 年 5 月 17 日

コメント済み:

2017 年 5 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by