Terminé

Prolog Programming Homework

General problem description

You will write a program which checks a work assignment against a collection of constraints to see whether the work assignment is acceptable.

In the IT Department of the Magrathean Construction Company, there are four work shifts during the day: 9:00-11:00, 11:00-1:00, 1:00-3:00, and 3:00-5:00. During each shift, four workers are needed: Two to answer customers' questions on the phone, one to repair computers, and one to fix network problems. No worker can work more than one job or shift during a day. Thus, it takes 16 different workers to fill all the jobs during a day.

The various employees of the company have different skills: some are good at answering phones, some are good at repairing computers, some are good at fixing network problems, and some are good at more than one of these tasks. An employee should only be assigned to a job if he/she has that job skill.

The input to your program will be a proposed job assignment (the phone, computer, and network workers for each of the four shifts), followed by a list of workers and their skills. The workers and their skills will be specified by a worker's name, then three numbers (1 or 0) indicating whether the person is good at answering phones, repairing computers, and fixing the network, in that order. 1 indicates that the employee has the skill, and 0 indicates that the employee does not have the skill.

Prolog problem

Write a Prolog program to solve the problem described above.

Define a predicate jobs_ok(+Assignment, +Employees). Assignment is a list of four sub-lists, one for each shift. Each sub-list contains the work assignment for that shift: 2 names for phones, followed by one for computer repair, followed by one for network repair. Employees is a list of sub-lists; each sub-list contains an employee's name, followed by three integers (1 or 0) indicating whether the employee is qualified for phones, computers, and networks, respectively. The predicate should succeed if the job assignment is acceptable and fail if the job assignment is not acceptable.

You may assume that the Assignment and Employees lists will be in the correct format when the function is called; you do not have to error-check for a non-list or an incorrectly formed list. In your program, you may write and call any additional predicates that are helpful in the computation.

Examples:

?- jobs_ok(

[

[park, dunbar, khan, lloyd],

[bashir, trivedi, ramos, franklin],

[schmidt, nakamura, andrews, chen],

[evans, goldberg, macmillan, ortiz]],

[

[andrews, 1, 1, 1],

[bashir, 1, 1, 1],

[chen, 1, 1, 1],

[dunbar, 1, 1, 1],

[evans, 1, 1, 1],

[franklin, 1, 1, 1],

[goldberg, 1, 1, 1],

[jefferson, 1, 1, 1],

[khan, 1, 1, 1],

[lloyd, 1, 1, 1],

[macmillan, 1, 1, 1],

[nakamura, 1, 1, 1],

[ortiz, 1, 1, 1],

[park, 1, 1, 1],

[ramos, 1, 1, 1],

[schmidt, 1, 1, 1],

[trivedi, 1, 1, 1]]).

should succeed,

and

?- jobs_ok(

[

[young, collins, vieira, liu],

[davis, ericson, kelly, singh],

[fitzgerald, gutierrez, martinez, tortorella],

[nguyen, jones, patel, zimmerman]],

[

[aziz, 1, 0, 0],

[blumenthal, 0, 1, 1],

[collins, 1, 1, 1],

[davis, 1, 0, 0],

[ericson, 1, 0, 0],

[fitzgerald, 1, 0, 1],

[gutierrez, 1, 0, 1],

[jones, 1, 1, 1],

[kelly, 0, 1, 1],

[liu, 1, 0, 1],

[martinez, 0, 1, 1],

[nguyen, 1, 0, 0],

[patel, 1, 1, 1],

[qureshi, 1, 1, 0],

[rodriguez, 1, 0, 0],

[singh, 0, 1, 1],

[tortorella, 0, 0, 1],

[williams, 1, 0, 0],

[vieira, 0, 1, 0],

[young, 0, 1, 0],

[zimmerman, 1, 1, 1]]).

should fail.

Compétences : Prolog

en voir plus : concept prolog programming langouage, calculate salary application using prolog programming, java programming homework, general description antique wall clocks, general description, general description software review

Concernant l'employeur :
( 1 commentaire ) Sewell, United States

Nº du projet : #29901655

Décerné à:

harshitagarwal00

I have read the whole project and I understood the requirements properly. I am experienced in Prolog and can provide you the structured code within specified time. I have already did few projects in Prolog and I can de Plus

%selectedBids___i_sum_sub_7% %project_currencyDetails_sign_sub_8% USD en 7 jours
(0 Commentaires)
0.0

3 freelances font une offre moyenne de 33 $ pour ce travail

idleswell

Hello, I use Prolog programming daily in my regular employment. I will write a Prolog predicate (plus support predicates) that confirm that the work assignments are allowed. You have not mentioned if an employee can Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 3 jours
(2 Commentaires)
3.6
mohamedelashry77

Hello, I am very interested in logic and constraint programming. As I am experienced with prolog for over 3 years and I have used it to build interesting programs. I have built an AI agent using prolog for searching Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 3 jours
(0 Commentaires)
0.0