-
Related to #2519: The following code finds a final time and assign a schedule based on constraints: schedule(FinTime, Schedule) :-
tasks(TasksDurs),
precedence_constr(TasksDurs, Schedule, FinTime),
assign_processors(Schedule, FinTime),
maplist(start, Schedule, Starts),
labeling([], Starts).
?- FinTime #=< 22, schedule(FinTime, Schedule).
%@ FinTime = 22, Schedule = [t1/1/2/4,t2/1/0/2,t3/2/0/2,t4/1/2/20,t5/2/2/20,t6/3/11/11,t7/3/0/11]
%@ ; FinTime = 22, Schedule = [t1/1/3/4,t2/1/0/2,t3/2/0/2,t4/1/2/20,t5/2/2/20,t6/3/11/11,t7/3/0/11]
%@ ; FinTime = 22, Schedule = [t1/1/4/4,t2/1/0/2,t3/2/0/2,t4/1/2/20,t5/2/2/20,t6/3/11/11,t7/3/0/11]
%@ ; FinTime = 22, Schedule = [t1/1/5/4,t2/1/0/2,t3/2/0/2,t4/1/2/20,t5/2/2/20,t6/3/11/11,t7/3/0/11]
%@ ; ... .
?- FinTime #=< 21, schedule(FinTime, Schedule).
%@ false. I think it would be useful to automatically find the lower bound without having to manually try each version. I feel like there's probably a better way to find the lower bound given a domain than by trial and error, something like: ?- FinTime in 20..30, schedule(FinTime, Schedule), labeling([min], [FinTime]).
%@ FinTime = 30, Schedule = [t1/1/0/4,t2/1/4/2,t3/1/6/2,t4/1/8/20,t5/2/8/20,t6/3/8/11,t7/3/19/11]
%@ ; FinTime = 30, Schedule = [t1/1/0/4,t2/1/4/2,t3/1/6/2,t4/1/8/20,t5/2/9/20,t6/3/8/11,t7/3/19/11]
%@ ; FinTime = 30, Schedule = [t1/1/0/4,t2/1/4/2,t3/1/6/2,t4/1/8/20,t5/2/10/20,t6/3/8/11,t7/3/19/11]
%@ ; FinTime = 30, Schedule = [t1/1/0/4,t2/1/4/2,t3/1/6/2,t4/1/9/20,t5/2/8/20,t6/3/8/11,t7/3/19/11]
%@ ; ... . And it would probably be faster if I dropped the labeling constraints in schedule(FinTime, Schedule) :-
tasks(TasksDurs),
precedence_constr(TasksDurs, Schedule, FinTime),
assign_processors(Schedule, FinTime). I saw the |
Beta Was this translation helpful? Give feedback.
Answered by
UWN
Sep 2, 2024
Replies: 1 comment 4 replies
-
What is the answer without labeling? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(It is often helpful to add extend the core relation with an argument for the variables to be labeled. Thus
schedule_(FinTime, Schedule, Zs)
. In this manner you get a bit more freedom with various search schemes to use the relation.)In your case it is not that easy to determine extrema. As long as there would be a single leaf answer. Just label with
FinTime
first. But in your case it is not evident in which of the many leaf answers the extremum is hidden so you have to enumerate them somehow.The most naive way would be to enumerate
FinTime
first beforeschedule_/3
and then label. Alternatively or complementarily labelupto_in
to avoid useless enumeration of irrelevant values. So you enu…