Advertisement
makispaiktis

Weapon Ascension Optimization

Oct 6th, 2024
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.43 KB | None | 0 0
  1. clear all
  2. close all
  3. clc
  4.  
  5. % Data
  6. small = 3;
  7. medium = 4;
  8. big = 11;
  9. TARGET = 7*small + 6*medium + big;
  10. % Matrices
  11. f = [1 1 1];  % Minimize sum of weights - just a logical objective function
  12. intcon = 1 : 3;
  13. A = [];    b = [];
  14. Aeq = [small medium big];
  15. beq = [TARGET];
  16. lb = zeros(3, 1);
  17. ub = [];
  18. % Solution
  19. [x, fval, exitflag, output] = intlinprog(f, intcon, A, b, Aeq, beq, lb, ub);
  20. display('Optimal vector solution:');
  21. x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement