Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :- use_module(library(lists)).
- :- use_module(library(clpfd)).
- %% P13 - Prova modelo algures no grupo do fb
- % attend(+, -, -)
- attend(FilmList, Goings, Worth) :-
- length(FilmList, N),
- length(Goings, N),
- domain(Goings, 0, 1),
- length(Tasks, N),
- generateTasks(FilmList, Goings, Tasks),
- Machines = [machine(1, 1), machine(0, 1000)],
- cumulatives(Tasks, Machines, [bound(upper)]),
- getWorthsList(FilmList, WorthsList),
- scalar_product(WorthsList, Goings, #=, Worth),
- append(Goings, [Worth], Vars),
- labeling([maximize(Worth)], Vars).
- generateTasks([], [], []).
- generateTasks([(S,D,_) | Films], [G | Goings], [task(S, D, _, G, 1) | Tasks]) :-
- generateTasks(Films, Goings, Tasks).
- getWorthsList([], []).
- getWorthsList([(_,_,Worth) | Films], [Worth | WorthsList]) :-
- getWorthsList(Films, WorthsList).
- % attend([(1,3,2), (1,4,4), (4,4,3)], Goings, Worth).
- % attend([(1,3,2), (1,4,4), (4,4,1)], Goings, Worth).
- % attend([(1,3,3), (1,4,4), (3,5,5), (4,1,1), (4,4,3), (5,4,3), (6,3,1), (8,3,3)], Goings, Worth).
Add Comment
Please, Sign In to add comment