intlinprog no feasible solution
Afficher commentaires plus anciens
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);
Réponses (1)
David Wilson
le 10 Avr 2019
0 votes
Are you sure you are implementing your either/or constraints properly? For example where is your "big M"?
Catégories
En savoir plus sur Nonlinear Optimization dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!