Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using JuMP
- using HiGHS
- Scaune = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"]
- C = length(Scaune)
- LiniiProductie = [1, 2, 3, 4, 5]
- P = length(LiniiProductie)
- Profit = [6, 5, 9, 5, 6, 3, 4, 7, 4, 3]
- Capacitate = [47, 19, 36, 13, 46]
- ResurseFolosite = [
- 6 4 2 3 1 10 2 9 3 5;
- 5 6 1 1 7 2 9 1 8 6;
- 8 10 7 2 9 6 9 6 5 6;
- 8 4 8 10 5 4 1 5 3 5;
- 1 4 7 2 4 1 2 3 10 1;
- ]
- IC2 = Model(HiGHS.Optimizer)
- @variable(IC2, x[c=1:C]>=0)
- @objective(IC2, Max, sum(Profit[c]*x[c] for c=1:C))
- @constraint(IC2, [p=1:P],
- sum(ResurseFolosite[p, c]*x[c] for c=1:C) <= Capacitate[p])
- optimize!(IC2)
- println("Status final: $(termination_status(IC2))")
- if termination_status(IC2) == MOI.OPTIMAL
- println("Valoarea functiei obiectiv: \$(objective_value(IC2))")
- for c = 1:C
- if value(x[c]) > 0.001
- println("Scaun de tip: ", Scaune[c], " a fost produs in cantitatea: ", value(x[c]))
- end
- end
- else
- println("Nici o solutie gasita")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement