intlinprog no feasible solution

2 次查看(过去 30 天)
John Mountney
John Mountney 2019-4-9
I am attepting to maximize the value of a portfolio by selecting 9 investments belonging to 6 categories from a list without replacement. The constraints are as follows:
investment 1: category A
investment 2: category B
investment 3: category C
investment 4&5: category D
investment 6&7: category E
investment 8: category F
investment 9: category B, C, D, E or F
Using intlinprog I get "Intlinprog stopped because no point satisfies the constraints." I have used intlinprog to solve similar problems in the past withouth encountering this error. Any suggestions are appreciated.
inputData = readtable('data.csv');
N = height(inputData);
intcon = 1:N;
A = inputData.cost';
b = 40e3;
Aeq = double([strcmp(inputData.category, 'A')'
strcmp(inputData.category, 'B')'
strcmp(inputData.category, 'C')'
strcmp(inputData.category, 'D')'
strcmp(inputData.category, 'E')'
strcmp(inputData.category, 'F')'
~strcmp(inputData.category, 'A')']);
beq = [1; 1; 1; 2; 2; 1; 1];
lowerBound = zeros(N,1);
upperBound = ones(N,1);
f = -(inputData.value);
[x, fval] = intlinprog(f, intcon, A, b, Aeq, beq, lowerBound, upperBound);

回答(1 个)

David Wilson
David Wilson 2019-4-10
Are you sure you are implementing your either/or constraints properly? For example where is your "big M"?

类别

Help CenterFile Exchange 中查找有关 Problem-Based Optimization Setup 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by