سیستم های خبره. Goal-Driven Reasoning or Backward Chaining برای حل مسائل...

Post on 28-Dec-2015

229 views 0 download

transcript

خبره های سیستم

Goal-Driven Reasoningor

Backward Chainingمسائل • حل است structured selectionبرای مناسب

• : راه بهترین از گزینه بهترین انتخاب سیستم هدفمتعدد های حل

مسئله: • Diagnosisمثالشود • می ساختاردهی قواعد قالب در دانشکنند • می تقسیم ها زیرمسئله به را مسئله قواعد

Goal-Driven Reasoningor

Backward Chaining

مثال•• IF

family is albatross andcolor is white

• THENbird is laysan albatross.

• IFfamily is albatross andcolor is dark

• THENbird is black footed albatross.

Goal-Driven Reasoningor

Backward Chaining

شود sub ruleبه ruleهر• می منتهی هامثال•

• IForder is tubenose andsize large andwings long narrow

• THENfamily is albatross.

Goal-Driven Reasoningor

Backward Chaining

مسیر • از کاربر از سوالهایی با سیستمsubrules سمت کند rulesبه می حرکت

برای مقداری یافتن جستجوی در مسئله و dدراینجا استکند می حرکت اول به آخر از

از اینجا به a=1,b=2در تا میشود برسدd=4کارشروع

Uncertainty

• . هم کاربران است غیرقطعی نهایی هدف گاهیدارند غیرقطعی پاسخهای

پزشکی: • در بیماری تشخیص سیستم مثالاست • مردد بیماری چند انتخاب بین پزشکوجود • پاسخ به رسیدن برای متعددی راههای

دارند

Data Driven Reasoning

قطعات • از تواند می مونتاژکامپیوتر سیستم یک . در کند طراحی را متعددی های سیستم مختلف

سیستم با goal drivenاینجا کندزیرا نمی کارشود می عوض راهها ورودی های داده تغییر

اینجا • است data driven reasoningدر مفید

Data Driven Reasoning

باید • اطاق مبلمان طراحی سیستم یک درداده قرار مختلف جاهای در وسیله تعدادی

داده. قرار اطاق در تجهیزات همه وقتی شونداست تمام مسئله شود

کنار • تلویزیون قراردادن برای قاعده ایناست couchرف

• IFunplaced tv andcouch on wall(X) andwall(Y) opposite wall(X)

• THENplace tv on wall(Y).

دیگر • دهد جا را تلویزیون قاعده این نمی fireوقتیشود

• Note that for a data driven system, the system must be initially populated with data, in contrast to the goal driven system which gathers data as it needs it.

ها داده نمایش

• Data representation•: داده نمایش سطح چهار

1.Attribute –value2.Object-attribute-value3.Records4.Frames

Attribute –value

• Example:• Color-white• Size-large

Object-attribute-value

سه • است الزم دارد شی چندین سیستم وقتی - - شود گرفته بکار مقدار خاصیت شی های گانه

مثال••- بزرگ – سایز مبل•- بزرگ- سایز صندلی

records

این • هستنددر ویژگی چندین دارای اشی گاهیمیشود استفاده رکوردها از حالت

زوجهای • تمام دارای رکوردبیس در شی هراست- مقدار ویژگی

Frames

• Frames add intelligence to the data representation, and allow objects to inherit values from other objects. Furthermore, each of the attributes can have associated with it procedures (called demons) which are executed when the attribute is asked for, or updated.

پرولوگ مبانی

Horn Clause Logic

است • هورن جمالت منطق بر مبتنی پرولوگ• • Horn Clause logic is a formal system for

reasoning about things and the way they relate to each other.

طبیعی • زبانهای نمایش فرم در جمله یکJohn is the father of Bill.

هورن • نمایش فرم در جمله همانfather("Bill", "John").

معمولی ruleیک • جمالت فرم بهX is the grandfather of Z, if X is the father of Y

and Y is the father of Z

هورن • جمالت شکل در قاعده همانgrandFather(Person, GrandFather) :-

father(Person, Father), father(Father, GrandFather).

•X,y,z هستند متغیرها:- as if

the comma that separates the relations as and.

Statements like "John is the father of Bill" are called facts,

while statements like "X is the grandfather of Z, if X is the father of Y

and Y is the father of Z" are called rules.

• A theory is a collection of facts and rules

کوچک تئوری یک

father("Bill", "John"). father("Pam", "Bill"). grandFather(Person, GrandFather) :- father(Person, Father), father(Father, GrandFather).

این نظیر سواالتی به پاسخگویی تئوری هدفاست سوال

• Is John the father of Sue?• Who is the father of Pam?• Is John the grandfather of Pam? ...

• Such questions are called goals

And they can be formalized like this

?- father("Sue", "John").

?- father("Pam", X).

?- grandFather("Pam", "John").

Such questions are called goal clauses or simply goals

Together facts, rules and goals are called Horn clauses, hence the name Horn Clause Logic

• Some goals like the first and last are answered with a simple yes or no.

• For other goals like the second we seek a solution, like X = "Bill".

Some goals may even have many solutions. For example:

?- father(X, Y).

has two solutions:

X = "Bill", Y = "John". X = "Pam", Y = "Bill".

• A Prolog program is a theory and a goal.

• When the program starts it tries to find a solution to the goal in the theory

فولدر: • از حتما مربوط crackتوجه جمالت تماماجرای هنگام و کرده کپی را سریال شماره به

پروژه اولینکنید • رجیستر را افزار نرم آن کمک به

PIE: Prolog Inference Engine

باید • شروع از کنید .PIE exampleقبل نصب را(Start -> Visual Prolog -> Install Examples).

• Open the PIE project in the VDE and run the program, as it is described in Tutorial 01: Environment Overview.

PIE: Prolog Inference Engine

Project menu>> open>> My documents>> visual prolog examples>> PIE >> pie project >>main >>run

صفحه فوق فایل اجرای میشود E PIبا ظاهر

PIE: Prolog Inference Engine

آن • در را زیر جمالت و کنید ایجاد ای تازه فایلدهید قرار

father("Bill", "John"). father("Pam", "Bill"). grandFather(Person, GrandFather) :- father(Person, Father), father(Father, GrandFather).

PIE: Prolog Inference Engine

شکل: • همین به را کوچک و بزرگ حروف توجهکنید وارد

Engine >> Reconsulte

به فایل شود می باعث کار بارگذاری engine اینشود

PIE: Prolog Inference Engine

پنجره • در بنویسید Dialogحال را زیر سوالfather(X,Y).

متغیرهای : .X,Yتوجه شوند نوشته بزرگ : را زیر سوال ونیز

grandFather(X,Y).. کنید مشاهده را نتایج

فایل • در برنامه -nikpie-desktopفولدرn3متنacer

نتایج

Extending the Family Theory

1تمرین •

نسبت • با و نسل سه در خانواده یک افراد برای- - - - - دایی ) خاله عمه مادربزرگ مادر مختلف های

. بنویسید( سیستم یک عمو

Extending the Family Theory

•: کنیم می بررسی را والدین ارتباطparent(Person, Parent) :- mother(Person, Parent).

parent(Person, Parent) :- father(Person, Parent).

والدین ارتباط

•: گوید می چنین اول قاعده• Parent is the parent of Person, if Parent is the

mother of Person

والدین ارتباط

رابطه • با را( ;عالمت) ORمیتوان والدین ارتباط: کرد تعریف

parent(Person, Parent) :- mother(Person, Parent); father(Person, Parent).

از شود می با ;توصیه نشودزیرا اشتباه ,استفاده. شود می

والدین ارتباط

•: دهیم می قرار برنامه در را زیر متن حال

mother (“Bill”,”Mary”).parent(Person, Parent) :- mother(Person, Parent); father(Person, Parent).

در سپس : dialog boxو پرسیم میparent(X,Y).

والدین ارتباط

) ( خواهر یا برادر نیا هم siblingرابطه

father(“Tom”,”John”).sibling(Person, Sibling) :- mother(Person,

mother),mother(Sibling, Mother).

sibling(Person, Sibling) :- father(Person, Father), father(Sibling, father).

روابط اگر که دهند می تکراری نتایج قواعد برخیدرمی را تکرار این علت کنیم بررسی دقیقا را

یابیم.. دارند یکسان پدر و یکسان مادر نفر دو مثال

کنیم می تعیین شرایطی دیگری مسئله در حالباشند دونفریکسان مادر هم و پدر هم که

fullBlodedSibling(Person, Sibling) :- mother(Person, Mother),

mother(Sibling, Mother), father(Person, Father), father(Sibling, Father).

: بنویسید دیالوگ صفحه درfullBlodedSibling(X,Y) .

برنامه متن

.fullBlodedSibling(X,Y)نتیجه

جمله می mother(“Tom”,”Mary”)باحذف تولید پاسخ یکشود.

کنید توجه زیر حالتهای به

دومی به ندارد جواب اول سوال وقتیپردازد نمی

• When solving a particular sub-goal, the facts and rules are always tried from top to bottom.

Failing

• A predicate invocation might not have any solution in the theory, for example calling parent("Hans", X) has no solution as there are no parent facts or rules that applies to "Hans". We say that the predicate call fails. If the goal fails then there is simply no solution to the goal in the theory.

• During the execution of a program a lot of alternative choices (known as backtrack points) might exist from earlier predicate calls. If some predicate call fails, then we will backtrack to the last backtrack point we met and try the alternative solution instead. If no further backtrack points exists then the overall goal has failed, meaning that there was no solution to it.

• تا• Backtracking• Page 9• Part1• Getting started• Help• Visual prolog

بگیرید نظر در را زیر مثال

Goal می حل راست به چپ از هاشوند

ابتدا • .callرا fatherپس کنیم میکنیم backtrack pointیک • می ایجاد دوم جمله به

کنیم می استفاده اول جمله از سپس و