Scheduler critique #2519
Replies: 4 comments 7 replies
-
If feels like this could/should be done with DCGs again 🤔 I will say this section took me awhile to figure out how it worked: precedence_constr( [], [], FinTime).
precedence_constr( [T/D | TDs], [T/Proc/Start/D | Rest], FinTime) :-
Start #>= 0, % Earliest start at 0
Start + D #=< FinTime , % Must finish by FinTime
precedence_constr( TDs, Rest, FinTime),
prec_constr( T/Proc/Start/D, Rest).
prec_constr( T/P/S/D, []).
prec_constr( T/P/S/D, [T1/P1/S1/D1 | Rest]) :-
( prec(T,T1), #=<(S+D, S1)
; prec(T1,T), #=<(S1+D1, S)
; true
),
prec_constr( T/P/S/D, Rest). At first I thought it had to be some kind of mistake because this is at least an The |
Beta Was this translation helpful? Give feedback.
-
(Side note, not relevant to your code) For tasks that involve scheduling with limited resources I really like linear logic it fits that problem space so well. |
Beta Was this translation helpful? Give feedback.
-
Ok, my cursory analysis of this program is that These predicates:
exist to assign constraints
My This tantalizing clue in the clpz docs makes me think that much better use could be made of the |
Beta Was this translation helpful? Give feedback.
-
One comment regarding the discussions themselves: Personally, I see no reason to close such discussion topics: People barely had a few days to even see this, and the topic may be interesting and attract comments even years into the future! |
Beta Was this translation helpful? Give feedback.
-
I adapted the resource constrained scheduler code from Prolog Programming for Artificial Intelligence.
It runs, and I think it's monotonic-ish, but I feel like there is a lot of room for improvement. In particular I feel like it's not really making good use of the more advanced features of clpz.
I've been manually checking results but I'm not exactly sure how to "prove" correctness.
Let me know what you think!
Gist: https://gist.github.com/jjtolton/d4d708c38a6769c64434a7869a26eabb
Code:
Original code from book:
Beta Was this translation helpful? Give feedback.
All reactions