Write a program in prolog to perform the critical path scheduling algorithm given the durations and prerequiests for each task.
Lists in Prolog or Lisp are quite different from arrays in other languages, because all the elements of an array have locations known in advance, and any element of an array can be reached as quickly as any other.
Prolog has no arrays, but it has two reasonable substitutes. Instead of using an array as a lookup table, you can use a set of facts, as in this table of prime numbers:
nthprime(1,2).
nthprime(2,3).
nthprime(3,5).
nthprime(4,7).
nthprime(5,11).
nthprime(6,13).
These table entries can be looked up very quickly. Of course it isn’t easy to add or change entries in this kind of table, though it’s perfectly possible. Another way to simulate an array is to use a functor with many arguments, and access the arguments individually using arg. For example, given the structure primes(2,3,5,7,9,11,13,17,19,23,29) you can pick out individual elements like this:
?- arg(1,primes(2,3,5,7,9,11,13,17,19,23,29),What). What = 2
?- arg(5,primes(2,3,5,7,9,11,13,17,19,23,29),What). What = 9
In effect, you are using the argument positions of a cons cell as if they were an array of pointers.
Write a program in prolog to perform the critical path scheduling algorithm given the durations and...
Write a Java program that will simulate SRTnext scheduling algorithms. For the algorithm, the program should compute waiting time and turnaround time of every job as well as the average waiting time and average turn around time Process Arrival time CPU Burst (in milliseconds) 6 P1 P2 P3 7 10 Ps
Write a Java program that will simulate SRTnext scheduling algorithms. For the algorithm, the program should compute waiting time and turnaround time of every job as well as the...
Write an algorithm for a simple task that you perform. Be sure to write the steps so that someone else could perform the task.
1. Write a Prolog program that returns the length of a list of numbers. For example: size([1, 2, 3, 4], len). then return len=4. 2. Write a Prolog program that reverses the given list. For example: reverse([a, b, c, d], X). then return X=[d, c, b, a].
Use any language
Task two Write a program that implements the following disk-scheduling algorithms: a. FCFS b. SSTF c. SCAN d. C-SCAN e.LOOK f. C-LOOK Your program will service a disk with 500 cylinders numbered 0 to 499. The program will generate a random series of 20 cylinder requests and service them according to each of the algorithms listed above. The proram will be passed the initial position of the disk head (as a parameter on the command line) and...
Write a Prolog program that computes binomial coefficient
What can be the limitations of critical path scheduling? Have a discussion of no less than 50 words.
Instructions Write a program in Java that implements the A* algorithm to find a path from any two given nodes. Problem Overview & Algorithm Description In a fully-observable environment where there are both pathable and blocked nodes, an agent must find a good path from their starting node to the goal node. The agent must use the A* algorithm to determine its path. For this program, you must use the Manhattan method for calculating the heuristic. Remember: your heuristic function...
write a program that will find the shortest path from a given
vertex to a given vertex. Your program must allow the user to enter
any start vertex and any destination vertex and output the shortest
path.
A B F E D Using the attached graph, write a program that will find the shortest path from a given vertex to a given vertex. Your program must allow the user to enter any start vertex and any destination vertex and output...
Consider the following project, all durations are in days. Find the critical path and which tasks have slack. What is the probability the project will be done in 50 days? How about in 53 days? Suppose any task can be crashed for up to two days for the same cost per day, but that tasks A and N cannot be crashed at all. Which tasks should be crashed if the project needed to be completed in 45 days with at...
Write a Prolog program to find the maximum, minimum, and range of values in a list of numbers. Please also provide the program with output.