Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear all
- close all
- clc
- % Data
- small = 3;
- medium = 4;
- big = 11;
- TARGET = 7*small + 6*medium + big;
- % Matrices
- f = [1 1 1]; % Minimize sum of weights - just a logical objective function
- intcon = 1 : 3;
- A = []; b = [];
- Aeq = [small medium big];
- beq = [TARGET];
- lb = zeros(3, 1);
- ub = [];
- % Solution
- [x, fval, exitflag, output] = intlinprog(f, intcon, A, b, Aeq, beq, lb, ub);
- display('Optimal vector solution:');
- x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement