You are on page 1of 34

Computers and Automation Engineering – “Artificial Intelligence”

o
o
o

o
o
Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 2

o


o

Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 3



o


o

Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 4


Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 5
‫‪ -‬سؤال جد !‪:‬‬ ‫السؤال اﻷسا‬ ‫‪‬‬
‫)‪(super AI‬‬ ‫‪ o‬اﳌن اﻷفضل؟ ح نصل ﳌستوى ال شر ) عيد اﳌنال(‬
‫موعت ن‪:‬‬ ‫يمكن تص يف ا‬ ‫‪‬‬
‫معا ة الرموز )‪(Symbol Processing Approaches‬‬ ‫‪ o‬منا‬ ‫‪TOP‬‬
‫‪ ‬عتمد ع فرضية نظام الرموز الف يائية‪ ،‬أي عمليات منطقية تطبق ع قواعد اﳌعرفة التصر حية كجمل مكتو ة‬
‫»باﳌنطق من اﳌرتبة اﻷو )‪(First Order logic‬‬ ‫‪DOWN‬‬
‫تحت الرمز ة )‪(Sub-Symbolic Processing Approaches‬‬ ‫‪ o‬منا‬
‫ً‬ ‫ً‬
‫‪ ‬الفكرة‪ :‬إن الذ اء ال شري ما صار متطورا إﻻ عد مليارات السنوات‪ !،‬إذا‪....‬صنع اﻵلة )الذكية( يجب أن يمر بمراحل‬ ‫‪UP‬‬
‫تطور مشا ة‬
‫‪ ‬ال ك ع صنع آﻻت ل ا قدرات ا يوانات البدائية من حيث معا ة اﻹشارة و ُنظم التحكم‪ ،‬ثم اﻹرتقاء ذا السلوك‪.‬‬
‫‪BOTTOM‬‬
‫)الشب ات العصبونية – القدرة ع التعلم(‬

‫)‪Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com‬‬ ‫‪6‬‬


‫الحساسات؟‬ ‫الوكيل ‪ :‬أي ء يمكن اعتباره كمدرك لبي ته من خﻼل‬ ‫‪‬‬
‫حساسات و يؤثر تلك الب ئة بواسطة محر ات‪.‬‬

‫نحن ستخدم مصط »إدراك« )‪ (percept‬لﻺشارة إ ‪:‬‬ ‫‪‬‬


‫‪ o‬اﳌدخﻼت ا سية للوكيل أي ظة معينة‪.‬‬
‫ء‬ ‫الوكيل و التار خ ال امل ل ل‬
‫‪ ‬سلسل إدراك ً‬
‫أدركه الوكيل سابقا‪.‬‬

‫المحركات؟‬ ‫‪action‬‬ ‫‪‬‬

‫)‪Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com‬‬ ‫‪7‬‬



(‫ يمكن وصف تصرف الوكيل كدالة ر اضية )دالة الوكيل‬o

F: P*(percept histories)  A(actions)

Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 8


function TABLE-DRIVEN-AGENT(percept) return an action

TABLE
persistent: Percept Sequence (Action) ‫الفعل‬
percept: a sequence , initially empty. PS1 A1
table: a table of actions, PS2 A2
indexed by percept sequences, PS3 A3
initially fully specified …… ……
…… ……
append: percept to the end of percepts …… ……
action  LOOKUP(percepts,table) Infinite
return action

Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 9


World (Environment)

Percept Action
ً
‫(التحرك يمينا‬١
(A or B) ‫ موقع الوكيل‬.١ ً
‫(التحرك سارا‬٢
(‫أو نظيف‬ ‫ حالة اﳌوقع )م‬.٢ ‫( شفط اﻷوساخ‬٣
Agent

Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 10


function REFLEX-VACUUM-AGENT(location, status)

return an action (Percept Sequence) ‫اﻹدراك‬ ‫الفعل‬


(Action)
{ A , Clean } Right
if status = Dirty then { A , Dirty } Suck
{ B , Clean } Left
return Suck
{ B , Dirty } Suck
elseif location = A then { A , Clean } ; { A , Clean } Right
return Right { A , Clean } ; { A , Dirty } Suck
…………… ……………
elseif location = B then
{ A , Clean } ; { A , Clean }; { A , Clean } Right
return Left { A , Clean } ; { A , Clean } ; { A , Dirty } Suck
…………… ……………
Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 11
‫‪ATIONALITY‬‬

‫‪‬‬

‫‪o‬‬

‫‪‬‬

‫‪ (١‬قياس اﻷداء )‪ (performance measure‬الذي يحدد معيار النجاح‪.‬‬


‫‪ (٢‬اﳌعرفة السابقة للوكيل )‪ (prior knowledge‬عن الب ئة‪.‬‬
‫‪ (٣‬اﻹجراءات )اﻷفعال( ال يمكن أن تؤد ا الوكيل‪.‬‬
‫‪ (٤‬سلسل إدراك الوكيل ح اﻵن‪.‬‬

‫)‪Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com‬‬ ‫‪12‬‬


‫ُ‬
‫لبناء الوكيل العقﻼ ي ﻻ بد من التفك بب ئة العمل اﳌطلوب منه‪ ،‬و ال عرف أو تحدد ب ـ ‪:‬‬ ‫‪‬‬

‫‪ (١‬قياس اﻷداء )‪(Performance measure‬‬


‫‪ (٢‬الب ئة )‪(Environment‬‬
‫‪ (٣‬ا ر ات )‪(Actuators‬‬
‫‪ (٤‬ا ساسات )‪(Sensors‬‬
‫‪The Taxi Driver Task Environment‬‬ ‫‪PEAS‬‬
‫الحساسات‬ ‫المحركات‬ ‫البيئة‬ ‫قياس اﻷداء‬ ‫نوع الوكيل‬
‫)‪(Sensors‬‬ ‫)‪(Actuators‬‬ ‫)‪(Environment‬‬ ‫)‪(Performance measure‬‬ ‫)‪(Agent Type‬‬
‫الطرق ‪ ،‬السيارات العجﻼت ‪ ،‬المسرع كاميرا ‪ ،‬سونار ‪ ،‬عداد السرعة ‪،‬‬ ‫اﻷمان ‪ ،‬السرعة ‪ ،‬القانونية‪،‬‬ ‫سائق السيارة‬
‫اﻷخرى ‪ ،‬المشاة ‪ ، ،‬المكبح ‪ ،‬الزمور )‪ ، (GPS‬عداد المسافات ‪ ،‬مقياس‬ ‫الراحة ‪ ،‬الرحلة ‪ ،‬الجدوى‬
‫التسارع ‪ ،‬حساسات المحرك ‪ ،‬لوحة‬ ‫‪ ،‬الكاشف‬ ‫الركاب‬
‫المفاتيح‬

‫)‪Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com‬‬ ‫‪13‬‬


Reference:
Artificial Intelligence: A Modern Approach, 3e,
Stuart J. Russell and Peter Norvig

Chess with a clock ?


Chess without a clock ?

Others ?

Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 14


‫تصنيف بيئة العمل‬
Fully Observable Partially Observable
Deterministic Stochastic
Episodic Sequential
Static
VS. Dynamic The Vacuum-Cleaner ?
Discrete Continuous
Taxi driving ?
Single Agent Multi-agent

The real world ???

Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 15


Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 16


function SIMPLE-REFLEX-AGENT(percept) return an action
persistent: rules , (a set of condition-action rules)

state  INTERPRET-INPUT(percept)
rule  RULE-MATCH(state , rules)
action  rule.ACTION
return action

Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 17


function MODEL-BASED-REFLEX-AGENT(percept) return an action
persistent:
state, the agent’s current conception of the world state
model, a description of how the next state depends on
current state and action
rules, a set of condition-action rules
action, the most recent action, initially none

state  UPDATE-STATE(state, action, percept, model)


rule  RULE-MATCH(state , rules)
action  rule.ACTION
return action

Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com)


18
Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 19
Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 20
Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 21
‫ننظر للعالم كمجموعة من ا اﻻت‪ ،‬فأي حالة تحقق ال دف؟‬ ‫‪‬‬

‫م مة الوكيل معرفة كيفية التصرف )إتخاذ القرار(‪ ،‬ا اضر و اﳌستقبل‪ ،‬بحيث‪:‬‬ ‫‪‬‬

‫‪ ‬يصل إ »ا الة ال دف أو الة قر بة م ا«‪.‬‬


‫‪ ‬يجب أن عمل الوكيل ع ز ادة قيمة قياس أدائه )‪(Performance measure‬‬
‫يحتاج إ ‪ :‬عض اﳌعلومات ال تصف ا اﻻت اﳌرغو ة‪) .‬ال دف(‬ ‫‪‬‬

‫‪ ‬سلسل اﻷحداث ال تحقق ذا ال دف‪.‬‬


‫ً‬
‫‪ ‬النظر إ اﳌستقبل‪" :‬ماذا سيحدث لو لم أفعل كذا وكذا؟" و " ل ذا يجعل سعيدا؟"‬

‫صياغة اﳌش لة‪(Problem formulation) :‬‬ ‫‪‬‬


‫ً‬
‫للوكيل النظر إل ا‪ ،‬وفقا لل دف‪.‬‬ ‫‪ ‬تكمن عملية تحديد اﻹجراءات و ا اﻻت ال ي ب‬

‫)‪Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com‬‬ ‫‪22‬‬


Example

A B ‫ب ئة العمل‬
(A , B-dirt)
(A or B) ‫ موقع الوكيل‬.١
(«Clean» ‫ نظيف‬، «Dirt» ‫ حالة اﳌوقع )م‬.٢
A B
(B , B-dirt) (State Space) ‫فضاء ا اﻻت‬

A B
(B , B-Clean)

Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 23


Current
State Sensors
State
What the world is

Environment
How the world evolve like now.

What it will be like


What my action do.
if I do action A.

What action I
Goals
should do now.
Final State
Next State
AGENT Actuators
Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 24
function SIMPLE-PROBLEM-SOLVING-AGENT(percept) return an action
persistent: seq, an action sequence, initially empty
state, description of the current world
goal, a goal, initially null
problem, a problem formulation

state  UPDATE-STATE( state , percept ) Problem


if seq is empty then: Formulation
goal  FORMULATE-GOAL(state)
problem  FORMULATE-PROBLEM( state , goal )
seq  SEARCH(Problem) Search
if seq = failure then return a null action
action  FIRST(seq)
seq  REST(seq) Execute
return action
Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 25

Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 26


‫‪7‬‬ ‫‪2‬‬ ‫‪4‬‬ ‫‪7‬‬ ‫‪4‬‬ ‫‪1‬‬ ‫‪2‬‬
‫‪5‬‬ ‫‪6‬‬ ‫‪5‬‬ ‫‪2‬‬ ‫‪6‬‬ ‫‪3‬‬ ‫‪4‬‬ ‫‪5‬‬
‫‪8‬‬ ‫‪3‬‬ ‫‪1‬‬ ‫‪8‬‬ ‫‪3‬‬ ‫‪1‬‬ ‫‪6‬‬ ‫‪7‬‬ ‫‪8‬‬
‫‪Start State‬‬ ‫‪Current State‬‬ ‫‪Goal State‬‬

‫‪States‬‬ ‫وصف الحالة‪ :‬يحدد موقع كل بﻼطة )‪ (tile‬من البﻼطات الثمانية و‬ ‫الحاﻻت‬
‫الفراغ ضمن المربعات التسعة‪.‬‬
‫‪Initial state‬‬ ‫أي حالة يمكن أن تُوصف بأنها الحالة اﻹبتدائية‪.‬‬ ‫الحالة اﻹبتدائية‬
‫‪Actions‬‬ ‫أبسط صياغة لﻸفعال و هوهنا وصف تحركات المساحة الفارغة و‬ ‫اﻷفعال‬
‫هي‪ :‬يسار )‪ ، (Left‬يمين )‪ ، (Right‬أعلى )‪ ، (Up‬أسفل )‪.(Down‬‬
‫‪Goal test‬‬ ‫هذا يتحقق إذا كانت الحالة تتطابق مع الحالة الهدف )أحيانا ً تحدد‬ ‫اختبار الهدف‬
‫الحالة الهدف وفقا ً لمجموعة من الخصائص(‪.‬‬
‫تحديد قيمة عددية للمسار‪) ،‬تكلفة الخطوة )‪Path cost ( C(Scurrent,A,Snext‬‬ ‫كلفة المسار‬
‫مثﻼً هنا‪ :‬تكلفة الخطوة = واحد‬
‫)‪Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com‬‬ ‫‪27‬‬
7 4 Goal State
Actions 
5 2 6 { Left , Right , Down }
1 2
8 3 1 3 4 5

Up 7 2 4 6 7 8
Initial State Actions 
5 6 { Right , Up , Down }
7 2 4 Left
8 3 1
5 6
Right 7 2 4
8 3 1 15-Puzzle
Actions 
5 6 { Left , Up , Down } 5 14 7 1
Down
Actions  8 3 1
{ Left , Right , Up , Down } 9 12 15

7 2 4 6 10 8 3
Actions 
5 3 6 { Left , Right , Up } 2 13 4 11

8 1

Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 28


States (Location , Status) ‫الحاﻻت‬
Initial state Any state ‫الحالة اﻹبتدائية‬
Actions Left , Right , Suck ‫اﻷفعال‬
Goal test ? ‫اختبار الهدف‬
Path cost ? ‫كلفة المسار‬
Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 29
A complete-state formulation An incremental formulation

A complete-state formulation An incremental formulation


‫الحاﻻت‬
‫الحالة اﻹبتدائية‬
‫اﻷفعال‬
‫اختبار الهدف‬
‫كلفة المسار‬

Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 30


‫اﻹبحار مواقع اﻹن ن ت‪ (in-car system) ،‬لتوف خدمة اتجا ات قيادة السيارة‪،‬‬
‫التطبيقات دليل السائح‪ ،‬تخطيط العمليات العسكر ة‪ ،‬توجيه دفق الفيديو شب ات‬
‫الكمبيوتر‪ ،‬أنظمة التخطيط للسفربالط ان‪ ،‬و ‪............‬‬
‫التخطيط للسفربالط ان نظام‬
‫ل حالة شمل اﳌوقع )‪) (Location‬اﳌطار( و الوقت ا ا )‪.(current time‬‬ ‫الحاﻻت‬
‫عﻼوة ع ذلك‪ ،‬و س ب ت لفة الفعل ) مجال الط ان( يمكن أن عتمد ع قطاعات أخرى‬
‫ً‬
‫)قواعد اﻷجرة ‪ -‬داخ أو عاﳌي( و بالتا يجب ع ا الة أيضا يل )تضم ن( معلومات‬
‫إضافية حول ذه القواعد‪.‬‬
‫يتم تحديد ذلك من خﻼل سؤال اﳌسافر‪.‬‬ ‫الحالة اﻹبتدائية‬
‫ً‬ ‫‪Route-Finding‬‬
‫اتخاذ أي رحلة من اﳌوقع ا ا ‪،‬تحديد فئة اﳌقعد‪ ،‬تحديد وقت اﻹنطﻼق بدأ من‬ ‫اﻷفعال‬ ‫‪Problem‬‬
‫الوقت ا ا ‪) ،‬ما يكفي من الوقت(‬
‫ا الة الناتجة‪ :‬اﳌوقع )‪ :(Location‬وج ة الرحلة ‪ -‬الوقت ا ا )‪ :(current time‬وقت الوصول‬ ‫نموذج التحويل‬
‫ل نحن الوج ة ال ائية ا ددة من قبل اﳌستخدم؟‬ ‫اختبار الهدف‬
‫ذا عتمد ع ‪ :‬الت لفة النقدية‪ ،‬وقت اﻻنتظار‪ ،‬زمن الرحلة ‪ ،‬إجراءات ا مارك و ال رة‪ ،‬جودة‬ ‫كلفة المسار‬
‫اﳌقعد‪ ،‬وقت السفر‪ ،‬نوع الطائرة‪ ،‬شرة جوائز ك ة‪ -‬اﻷميال‪ ،‬و ‪......‬‬
‫)‪Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com‬‬ ‫‪31‬‬
‫مش لة السياحة )‪(Touring problems‬‬ ‫‪‬‬

‫إيجاد اﳌسار لكن تختلف ع ا ‪:‬‬ ‫‪o‬‬


‫‪ ‬ز ارة ل اﳌدن مرة واحدة ع اﻷقل‪.‬‬
‫ُ‬
‫‪ ‬توصيف ا اﻻت )اﳌدينة ا الية و قائمة اﳌدن اﳌزارة(‬
‫})‪In(Homs), {In(Hama), In(Idlib), In(Latakia‬‬
‫‪ ‬ال دف )السائح اﳌدينة ال بدأ م ا و زار ل اﳌدن(‪.‬‬
‫مش لة البا ع اﳌتجول )‪(Traveling Salesman‬‬ ‫‪‬‬

‫مش لة إيجاد مسار سائح لكن تختلف ع ا ‪:‬‬ ‫‪o‬‬


‫‪ ‬ز ارة ل مدينة ﳌرة واحدة فقط؛ و دف ﻹيجاد أقصر مسار‪.‬‬
‫‪ ‬تطبيقات‪ :‬تخطيط مسار ا فر ع الدارات اﻷليك ونية ‪ ،‬تخطيط عمل آﻻت التخزن ع رفوف متجر‪.‬‬

‫)‪Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com‬‬ ‫‪32‬‬


‫مش لة تخطيط دارات الت امل الفائق )‪(VLSI “Very Large Scale Integration” layout‬‬ ‫‪‬‬

‫‪ o‬تحديد اﳌواقع ﳌﻼي ن من اﳌ ونات و الوصﻼت ع الرقاقة لتقليل اﳌساحة اﳌستخدمة‪ ،‬تقليل‬
‫تأخ الدارة‪ ،‬و تقليل السعة الشاردة‪ ،‬و عظيم جودة و غلة التص يع‪.‬‬
‫مش لة مﻼحة الرو وت )‪(Robot navigation‬‬ ‫‪‬‬

‫‪ o‬عميم ﳌش لة إيجاد اﳌسار ‪ :‬بدﻻ من مجموعة منفصلة من اﳌسار ات‪ ،‬يمكن للرو وت أن‬
‫يتحرك فضاء مستمر مع )من حيث اﳌبدأ( مجموعة ﻻ ائية من اﻷفعال و ا اﻻت‬
‫ا تملة‪.‬‬
‫مش لة سلسل التجميع اﻵ )‪(Automatic assembly sequencing‬‬ ‫‪‬‬

‫‪ o‬تجميع أغراض معقدة بواسطة رو وت‪.‬‬


‫‪ o‬تصميم ال وت ن – إيجاد سلسل اﻷحماض اﻷمي ية‪.‬‬

‫)‪Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com‬‬ ‫‪33‬‬


Computers and Automation Engineering – “Artificial Intelligence”

Artificial Intelligence 19-20 / Dr. Aghiad Kh. (email: aghiad_kh@hotmail.com) 34

You might also like