[[
✎ pl:miw:miw08_ruleruntimeg_2
]]
aiWiki
Pokaż stronę
Ostatnie zmiany
Indeks
Zaloguj
Ta strona jest tylko do odczytu. Możesz wyświetlić źródła tej strony ale nie możesz ich zmienić.
====== Opis ====== Damian Janicki <janicki.damian@gmail.com> Investigate runtime integration aspects, mainly semi-automatical building of a GUI for Prolog programs possibilities XPCE, Static QT/Gtk, Gtk-Server, Java (Swing), Eclipse (SWT) * input XPCE, QT, GTK, GtkServer, Java etc., SWI Prolog documentation * output Feasibility study, a prototype. * integration options for Java: JPL (SWI),Logtalk (OO Prolog), architecture: MVC * approach: 2 -3 app. cases, M prolog, V in Java, C -> JPL/Logtalk, e.g. ready M in Prolog, build V in Java: Car ES, opposite: ready MV i Java, build M in Prolog, make it work with the V ====== Spotkania ====== ===== 08.03.04 ===== * **MISSED** prototyp dla car, tj. ask_question ===== 080311 ===== * problems, problems ===== 080318 ===== * przerobienie car na wywołanie V w Javie ====== Projekt ====== Oryginalny system ([[pl:prolog:prolog_lab:prolog_lab_2#tematprosty_system_ekspertowy]]) <code prolog> % From the book % PROLOG PROGRAMMING IN DEPTH % by Michael A. Covington, Donald Nute, and Andre Vellino % (Prentice Hall, 1997). % Copyright 1997 Prentice-Hall, Inc. % For educational use only % File CAR.PL % Simple automotive expert system :- consult('getyesno.pl'). % Use ensure_loaded if available. % % Main control procedures % start :- write('This program diagnoses why a car won''t start.'),nl, write('Answer all questions with Y for yes or N for no.'),nl, clear_stored_answers, try_all_possibilities. try_all_possibilities :- % Backtrack through all possibilities... defect_may_be(D), explain(D), fail. try_all_possibilities. % ...then succeed with no further action. % % Diagnostic knowledge base % (conditions under which to give each diagnosis) % defect_may_be(drained_battery) :- user_says(starter_was_ok,yes), user_says(starter_is_ok,no). defect_may_be(wrong_gear) :- user_says(starter_was_ok,no). defect_may_be(starting_system) :- user_says(starter_was_ok,no). defect_may_be(fuel_system) :- user_says(starter_was_ok,yes), user_says(fuel_is_ok,no). defect_may_be(ignition_system) :- user_says(starter_was_ok,yes), user_says(fuel_is_ok,yes). % % Case knowledge base % (information supplied by the user during the consultation) % :- dynamic(stored_answer/2). % (Clauses get added as user answers questions.) % % Procedure to get rid of the stored answers % without abolishing the dynamic declaration % clear_stored_answers :- retract(stored_answer(_,_)),fail. clear_stored_answers. % % Procedure to retrieve the user's answer to each question when needed, % or ask the question if it has not already been asked % user_says(Q,A) :- stored_answer(Q,A). user_says(Q,A) :- \+ stored_answer(Q,_), nl,nl, ask_question(Q), get_yes_or_no(Response), asserta(stored_answer(Q,Response)), Response = A. % % Texts of the questions % ask_question(starter_was_ok) :- write('When you first started trying to start the car,'),nl, write('did the starter crank the engine normally? '),nl. ask_question(starter_is_ok) :- write('Does the starter crank the engine normally now? '),nl. ask_question(fuel_is_ok) :- write('Look in the carburetor. Can you see or smell gasoline?'),nl. % % Explanations for the various diagnoses % explain(wrong_gear) :- nl, write('Check that the gearshift is set to Park or Neutral.'),nl, write('Try jiggling the gearshift lever.'),nl. explain(starting_system) :- nl, write('Check for a defective battery, voltage'),nl, write('regulator, or alternator; if any of these is'),nl, write('the problem, charging the battery or jump-'),nl, write('starting may get the car going temporarily.'),nl, write('Or the starter itself may be defective.'),nl. explain(drained_battery) :- nl, write('Your attempts to start the car have run down the battery.'),nl, write('Recharging or jump-starting will be necessary.'),nl, write('But there is probably nothing wrong with the battery itself.'),nl. explain(fuel_system) :- nl, write('Check whether there is fuel in the tank.'),nl, write('If so, check for a clogged fuel line or filter'),nl, write('or a defective fuel pump.'),nl. explain(ignition_system) :- nl, write('Check the spark plugs, cables, distributor,'),nl, write('coil, and other parts of the ignition system.'),nl, write('If any of these are visibly defective or long'),nl, write('overdue for replacement, replace them; if this'),nl, write('does not solve the problem, consult a mechanic.'),nl. </code> V: Interfejs w Javie <code java> </code> ====== Sprawozdanie ====== ====== Materiały ====== [[pl:miw:miw08_ruleruntimeg_2:pliki|zrodla]] [[http://www.swi-prolog.org/packages/jpl/|JPL - Prolog/Java interface]]
pl/miw/miw08_ruleruntimeg_2.1205778926.txt.gz
· ostatnio zmienione: 2019/06/27 15:58 (edycja zewnętrzna)
Pokaż stronę
Poprzednie wersje
Menadżer multimediów
Do góry