SHARE
TWEET

Untitled

a guest Mar 25th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. param n, integer;
  2. param F;
  3. #weights
  4. param w{1..n};
  5. #values
  6. param v{1..n};
  7. #decision variables
  8. var x{1..n}, binary;
  9. #objective function
  10. maximize obj: sum{i in 1..n} v[i]*x[i];
  11. #constraints
  12. subject to
  13. c1: sum{i in 1..n} w[i]*x[i]<=F;
  14. solve;
  15. display x;
  16. display sum{i in 1..n} w[i]*x[i];
  17. display obj;
  18. data;
  19. param F:=15;
  20. param n:= 4;
  21. param v:= 1 7
  22.           2 6
  23.           3 7
  24.           4 5;
  25. param w:= 1 8
  26.           2 5
  27.           3 7
  28.           4 4;
  29. end;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top