Torsten <
Torsten...@umsicht.fraunhofer.de> wrote in message <
f0ae0bdb-4bd0-4e72...@y42g2000yqh.googlegroups.com>...
Dear Torsten,
Here is the problem which is working:
Objective function:
CostMatrix =
34 37 35 72
38 35 37 72
38 39 33 72
38 39 33 72
But I convert 4x4 to 1x16 because of problem mentioned above. For this I use a custom function LinearizeArray:
LCostMatrix = LinearizeArray(CostMatrix);
So now,
LCostMatrix =
Columns 1 through 14
34 37 35 72 38 35 37 72 38 39 33 72 38 39
Columns 15 through 16
33 72
Constraints:
Inequality Constraints A and B
A = repmat(eye(4),1,4);
% Construction of matrix B for inequality
B = CAPACITY*ones(4,1);
So, A and B are:
A =
Columns 1 through 14
1 0 0 0 1 0 0 0 1 0 0 0 1 0
0 1 0 0 0 1 0 0 0 1 0 0 0 1
0 0 1 0 0 0 1 0 0 0 1 0 0 0
0 0 0 1 0 0 0 1 0 0 0 1 0 0
Columns 15 through 16
0 0
0 0
1 0
0 1
B =
2
2
2
2
Equality Constraints (Aeq and Beq) are:
Aeq =
Columns 1 through 14
1 1 1 1 0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 1 1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1 1 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 1
Columns 15 through 16
0 0
0 0
0 0
1 1
Beq =
1
1
1
1
Finally without looping, I run the bintprog as below:
[map MinCost] = bintprog(LCostMatrix,A,B,Aeq,Beq);
map =
1
0
0
0
0
1
0
0
0
0
1
0
0
0
1
0
Now I convert back the map to 4x4 arrray.
MemMap = VectorizeArray(map,4,4);
1 0 0 0
0 1 0 0
0 0 1 0
0 0 1 0
My question:
Is there a way execute bintprog as below and get result as 4x4 matrix? without modifying it as shown above?
x = bintprog(CostMatrix,A,B,Aeq,Beq)
Where x has to be 4x4 or in other words the dimensions as CostMatrix?
And
Where:
CostMatrix =
34 37 35 72
38 35 37 72
38 39 33 72
38 39 33 72
A =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
B =
2
2
2
2
Aeq =
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
Beq =
1
1
1
1
I hope the problem is now clear.
Regards,
Rakshith Amarnath