r/prolog • u/body03071998 • Mar 13 '20
how can i make resource allocation program using prolog
how can i make resource allocation program using prolog i am just new at prolog and want some help at the beginning cause i have tried so many times but every time i wont find anything and there is no thing in internet to help me?
i have coded the below code but the problem i want code that take 4 processes and 2 resources and print the execution order of the processes if there is no deadlock and if there is a deadlock print false thanks in advance
0
Upvotes
2
u/crundar Mar 14 '20
I think you should go back and ask your professor for more help. That will probably be faster and more useful.
9
u/cbarrick Mar 13 '20 edited Mar 13 '20
Edit: I just realized this is basically the same question that was asked yesterday, and that you double posted the same question. I appreciate that you are trying to learn, but both of these actions are poor form. You should contribute to that thread instead of starting a new thread: https://www.reddit.com/r/prolog/comments/fhdi8s
Look into CLP(FD). It's a library for constraint logic programming / constraint satisfaction on finite domains. It is included with SWI-Prolog.
If you have the book Artificial Intelligence: a Modern Approach, there is a good chapter on constraint satisfaction that covers a very similar job-shop scheduling problem. There are also smaller sections on logic programming and constraint logic programming. (It sounds like your assignment is basically to read this chapter and implement the scheduler).
If you need an introduction to Prolog in general, check out the free online book Learn Prolog Now!.