Question: If someone can please provide Prolog code for this that would be amazing Description In this project you will create the Prolog backend for an

If someone can please provide Prolog code for this that would be amazing
Description
In this project you will create the Prolog backend for an imagimary webapp. The webapp will allow a user to prepare a work schedule. The user can specify what work stations exists (with the number of people needed), and the employees with their skills, and time constraints. The information will be saved as ficts in a file that will be consulted with your code. You need to implement plan/1 which will depend ou these facts and will be queried to compute a schedule.
Details
You will implement plaw/1 and any predicates necessary to implement it. The predicate should work even if called with an unbound variable as its parameter. The parameter should be unified with the plaw/3 structure. The three parameters repsesent the schedules for the moming. evening, and night shifts - in that order. Each schedule is a list of workstation/2 structures, with the first parameter being a workstution and the second a list of employees.
The plan must follow the following requirements. If no such plan can be constructed, plan/1 should fail.
- Every employee must work exactly one workstation for exaetly one shift.
- No work station can be worked by fewer employees than the minimum.
- No work station can be worked by wore employees than the maximum.
- The schedule should not contain workstations that are idle that shift.
- No workstation should be worked by an employee that should avoid it.
- No employee should be scheduled for a shift that the employee should avoid.
Input Predicates
You may assume a filk containing all related facts exists, and is consulted with your code. An example file will be provided, but you should also make more for testing, It will contain facts for the following predicates.
- employee/1
- Each fact will unify the first parameter with an employee
- workstation/3
- Relates a workstation (first parameter) with the minimum and maxinum number of employees needed (second and third parameter).
- workstation_1dte/2
- Relates a workstation (first parameter) with a shift (second parameter) It represents shifts in which the workstation will not be used. A shift can be one of three constants: norning. evening, night.
- avoid_vorkstation/2
- Relates an employee (first parameter) with a workstation (second parameter), and represents workstations this employee cannot work at.
- avoid_shift/2
- Relates an employee (first parameter) with a shift (second parameter). It represents the shift the employee cannot work A shift can be one of three coustants: morning, evening, wight.
Hints and Advice
- You do not need to print anything-
- The trace/e predicate can be used to activate tracing mode.
- Tracing mode will allow you to see the steps of Prolog's execution.
- The +1 indalt/3 predicate can couvert disjunctive answers to a list.
- As an example, we can get a list of employees as follows.
- findall(E enployee(E), Enplayees).
- The first parameter tells us what we want to collect. It can be any Prolog term, but should coutain at least one variable.
- The second parameter is a goal It will be queried, and every time it succeeds it will backtrack to generate a new answer.
- The third parameter is a list of collected terms, each one corresponding to an answer generated by the goal.
- If you want a predicate to be true based on the disjusction of two things, use two rules.
- The cut can be useful for avoiding duplicated code.
- Negation-as-fallure can be useful when making decisions based on not having something.
If someone can please provide Prolog code for

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!