Constraints And Adversarial Search

Slides:



Advertisements
Presentasi serupa
INTRO (TO BPOS). What is BPOS? Apakah BPOS itu? •BPOS = (Microsoft) Business Productivity Online Suite (Service) •adalah sebuah layanan online Microsoft,
Advertisements

Developing Knowledge Management dalam perusahaan Week 10 – Pert 19 & 20 (Off Class Session)
Array.
INTRO TO BPOS ( Coffey’s Project Portal). What is BPOS? Apakah BPOS itu? •BPOS = (Microsoft) Business Productivity Online Suite (Service) •adalah sebuah.
Pengujian Hipotesis untuk Satu dan Dua Varians Populasi
This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2006 Microsoft Corporation. All.
Mata Kuliah : ALGORITMA dan STRUKTUR DATA 1.
PEMOGRAMAN BERBASIS JARINGAN
QUESTION- RESPONSE QUESTION- RESPONSE. Adaptif Hal.: 2 Isi dengan Judul Halaman Terkait Judul Halaman Pada bagian question-response, pertanyaan-pertanyaan.
PERUBAHAN VS PERBAIKAN Center for Continuous Improvement, Today is better than yesterday, tomorrow is better than today
Materi Analisa Perancangan System.
THE FINDING A PATTERN STRATEGY STRATEGI MENEMUKAN POLA Oleh Kelompok 3.
IT SEBAGAI ALAT UNTUK MENCIPTAKAN KEUNGGULAN KOMPETISI
1 Pertemuan 21 Pompa Matakuliah: S0634/Hidrologi dan Sumber Daya Air Tahun: 2006 Versi: >
PERULANGANPERULANGAN. 2 Flow of Control Flow of Control refers to the order that the computer processes the statements in a program. –Sequentially; baris.
REVIEW.
Slide 3-1 Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Revised by IB & SAM, Fasilkom UI, 2005 Exercises Apa saja komponen utama.
Estimasi Prob. Density Function dengan EM Sumber: -Forsyth & Ponce Chap. 7 -Standford Vision & Modeling Sumber: -Forsyth & Ponce Chap. 7 -Standford Vision.
Prof. Busch - LSU1 Mathematical Preliminaries. Prof. Busch - LSU2 Mathematical Preliminaries Sets Functions Relations Graphs Proof Techniques.
Review IS & Software System Concept Diah Priharsari PTIIK – Universitas Brawijaya Source: 1.Obrien & Marakas, Management Information.
Introduction to The Design & Analysis of Algorithms
IF-ITB/SAS/25Aug2003 IF7074 – Bagian Pertama Page 1 IF 7047 Kewirausahaan Teknologi Informasi Bagian Pertama: 1.1. Entrepreneurship, entrepreneur, dan.
MATERI 6 PERILAKU ORGANISASI
Artificial Intelligence
PROSES PADA WINDOWS Pratikum SO. Introduksi Proses 1.Program yang sedang dalam keadaan dieksekusi. 2.Unit kerja terkecil yang secara individu memiliki.
1. Objek dalam kalimat aktif menjadi subjek dalam kalimat pasif
Review Operasi Matriks
Jeff Howbert Introduction to Machine Learning Winter Classification Nearest Neighbor.
How to express certainty and uncertainty
Internal dan Eksternal Sorting
GERUND
Ekonomi Manajerial dalam Perekonomian Global
Could not load an object because it is not avaliable on this machine. Tidak dapat memuat sebuah benda karena tidak tersedia pada mesin ini.
Functions (Fungsi) Segaf, SE.MSc. Definition “suatu hubungan dimana setiap elemen dari wilayah saling berhubungan dengan satu dan hanya satu elemen dari.
Bilqis1 Pertemuan bilqis2 Sequences and Summations Deret (urutan) dan Penjumlahan.
VALUING COMMON STOCKS Expected return : the percentage yield that an investor forecasts from a specific investment over a set period of time. Sometimes.
2-Metode Penelitian Dalam Psikologi Klinis
Implementing an REA Model in a Relational Database
MEMORY Bhakti Yudho Suprapto,MT. berfungsi untuk memuat program dan juga sebagai tempat untuk menampung hasil proses bersifat volatile yang berarti bahwa.
Basisdata Pertanian. After completing this lesson, you should be able to do the following Identify the available group functions Describe the use of group.
2nd MEETING Assignment 4A “Exploring Grids” Assignment 4 B “Redesign Grids” Create several alternatives grid sysytem using the provided elements: (min.
BENTUK ING VERB + ING. Bentuk ING juga biasa disebut dengan ING form Meskipun pembentukannya sangat se- derhana tetapi penggunaannya mem- punyai aturan.
Slide 1 QUIS Langkah pertama caranya Buat di slide pertama judul Slide kedua soal Slide ketiga waktu habis Slide keempat jawaban yang benar Slide kelima.
Roundtable discussion on citizen engagement for good governance in East Indonesia diskusi keterlibatan penduduk untuk tata pemerintahan yang baik di Indonesia.
LOGO Manajemen Data Berdasarkan Komputer dengan Sistem Database.
TRAVERSING BINARY TREE
Linked List dan Double Linked List
Amortization & Depresiasi
3.1 © 2007 by Prentice Hall OVERVIEW Information Systems, Organizations, and Strategy.
Contentment Philippians 4: Contentment What does it mean to be content? What does it mean to be content? Are you a content person? Are you a content.
SMPN 2 DEMAK GRADE 7 SEMESTER 2
Algoritma Pencarian Blind
Operator dan Assignment Pertemuan 3 Pemrograman Berbasis Obyek Oleh Tita Karlita.
THE EFFICIENT MARKETS HYPOTHESIS AND CAPITAL ASSET PRICING MODEL
1. 2 Work is defined to be the product of the magnitude of the displacement times the component of the force parallel to the displacement W = F ║ d F.
Via Octaria Malau Transfer (Internal Transfers) Transfer (Transfers Internal) Select the account from which funds are to be transferred FROM and then select.
Double Linked List. © 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Double Linked List Sama seperti single linked list, double.
Red -BlackTrees Evaliata Br Sembiring.
The intensive state of a PVT system containing N chemical species and  phases in equilibrium is characterized by the intensive variables, temperature.
Retrosintetik dan Strategi Sintesis
Web Teknologi I (MKB511C) Minggu 12 Page 1 MINGGU 12 Web Teknologi I (MKB511C) Pokok Bahasan: – Text processing perl-compatible regular expression/PCRE.
Made by: Febri, Andrew, Erina, Leon, Luvin, Jordy
Problem Solving Game Playing
Game playing Kecerdasan Buatan Pertemuan 5 IT-EEPIS.
Yufis Azhar – T.Informatika - UMM
1 Pertemuan 15 Game Playing Matakuliah: T0264/Intelijensia Semu Tahun: Juli 2006 Versi: 2/1.
Constraint Satisfaction Problem (CSP)
Minimalist Motion Planning Using Global Topological Guarantees
Complexity of A* Complexity is exponential unless
Lecture 8 Normal model.
Transcript presentasi:

Constraints And Adversarial Search CSP Min Max

Constraint Satisfaction Problems (CSP) CSP atau Constraint Satisfaction Problem adalah permasalahan yang tujuannya adalah mendapatkan suatu kombinasi variabel-variabel tertentu yang memenuhi aturan-aturan (constraints) tertentu. State didefinisikan dengan variables Xi yang mempunyai values dari domain Di Goal Test adalah sebuah himpunan constraints yang memberikan kombinasi yang diijinkan untuk mengisi variabel Batasan CSP dalam perkuliahan ini: diskrit (solusi deterministik), absolut (solusi pasti tersedia dalam domain), unair atau biner (satu atau dua variabel yang harus diisi).

CSP Example: Map-Coloring Variables: WA, NT, Q, NSW, V, SA, T Domains: Di = {red, green, blue} Constraints: adjacent regions must have different colors e.g.: WA ≠ NT, WA ≠ SA, NT ≠ SA, ... (if the language allow this), or (WA,NT) Є { (red, green), (red, blue), (green, red),...}

CSP Example: Map-Coloring Solutions are complete and consistent assignments, e.g. {WA=red, NT=green, Q=red, NSW=green, V=red, SA=blue, T=green}

Varieties of Constraints Unary : Constraints involve a single variable e.g.: SA ≠ green Binary : Constraints involve pairs of variables e.g.: SA ≠ WA Higher-Order : Constraints involve 3 or more variables e.g.: cryptarithmetic column constraints Preferences (soft constraints) : e.g.: blue is better than green. (Often representable by a cost for each variable assignment  Constrained Optimization Problems

Standard Search Formulation for CSP States ditentukan dengan nilai yang sudah dialokasikan sekarang Initial State: { } Successor Function: assign value ke variable yang belum terisi nilai tidak boleh melanggar constraint Goal Test: bila assignment selesai dilakukan Catatan: Hal ini berlaku untuk setiap masalah CSP Karena variable terbatas maka setiap solusi akan muncul pada kedalaman n dengan n variable  gunakan depth-first Search Karena path irrelevan kita dapat gunakan algoritma local search

Backtracking Example: Map Coloring

Backtracking Example: Map Coloring

Backtracking Example: Map Coloring

Backtracking Example: Map Coloring

Memperbaiki backtracking Variable yang mana yang harus di assign terlebih dahulu ? Bagaimana urutan nilai dicoba ? Bisakah kita mendeteksi kegagalan lebih awal Dapatkah kita menggunakan struktur problem untuk membantu kita ?

Backtracking Search

Forward Checking Idenya : Simpan nilai valid untuk variable yang belum diassign Bila salah satu variable tidak mempunyai kemungkinan nilai yang valid maka pencarian dihentikan

Forward Checking Idenya : Simpan nilai valid untuk variable yang belum di-assign Bila salah satu variable tidak mempunyai kemungkinan nilai yang valid maka search dihentikan

Forward Checking Idenya : Simpan nilai valid untuk variable yang belum diassign Bila salah satu variable tidak mempunyai kemungkinan nilai yang valid maka search dihentikan

Forward Checking Idenya : Simpan nilai valid untuk variable yang belum diassign Bila salah satu variable tidak mempunyai kemungkinan nilai yang valid search dihentikan

Constraint Propagation Forward checking memberikan informasi dari variabel yang dialokasi, namun tidak dapat mendeteksi kegagalan sebelumnya. NT dan SA tidak boleh diberikan warna biru ! Constraint Propagation secara berulang mengevaluasi alokasi variabel dalam skala lokal (solusi sementara)

Constraint Propagation: Map Coloring Isikan bidang (R1..R7) di atas dengan warna: merah, kuning, hijau, biru. Bidang bertetangga tidak boleh memiliki warna yang sama. Apakah variabel yang Anda gunakan? Apakah domain yang tersedia? Bagaimana Anda mengevaluasi constraints-nya?

Constraint Propagation: Map Coloring Variabel yang harus diisi: R1, .. R7 Domain yang tersedia: warna (merah, kuning, hijau, biru) Constraints: R1 <> R2, …, R7, R2 <> R3, R3 <> R4, R4 <> R5, R5 <> R6, R6 <> R7

Constraint Propagation: Map Coloring

Constraint Propagation: Map Coloring

Constraint Propagation: Map Coloring

Constraint Propagation: Map Coloring

Constraint Propagation: Map Coloring

Constraint Propagation: Map Coloring Backtracking

Constraint Propagation: Map Coloring

Constraint Propagation: Map Coloring

Constraint Propagation: Map Coloring Backtracking

Constraint Propagation: Map Coloring Backtracking

Constraint Propagation: Map Coloring

Constraint Propagation: Map Coloring Backtracking

Constraint Propagation: Map Coloring Backtracking

Constraint Propagation: Map Coloring

Constraint Propagation: Map Coloring Backtracking

Constraint Propagation: Map Coloring Backtracking

Constraint Propagation: Map Coloring Backtracking

Constraint Propagation: Map Coloring

Constraint Propagation: Map Coloring

Constraint Propagation: Map Coloring

Constraint Propagation: Map Coloring

Constraint Propagation: Map Coloring

Most Constrained Variable Heuristic Pilih variabel dengan kemungkinan nilai legal paling sedikit, constraint terbesar. (Cari variabel yang paling susah untuk diisi) Dikenal juga dengan heuristik Minimum Remaining Values (MRV)

Least Constraining Value Diberikan sebuah variabel, pilihlah yang memiliki nilai constraint paling sedikit (legalitas terbesar, variabel yang paling mudah diisi)

Degree Heuristic Pilih variabel dengan constraint paling besar diantara variabel yang belum terisi (kumpulkan variabel-variabel yang paling sulit diisi) Tie-breaker diantara MRV variabel

CSP Solution = Arc Consistency

Contraint Graph Decomposition

Game Playing Why game playing ? It’s Fun Game Playing is non trivial Player need ‘human-like’ intelligence Games can vary in complexity Decision making should be done in limited time Games are : Well defined and repeatable Limited and accessible Games Can directly compare human and computer

The History of AI in games Checkers: – 1994: Chinook (U.of A.) beat world champion Marion Tinsley, ending 40-yr reign. Othello: – 1997: Logistello (NEC research) beat the human world champion. – Today: world champions refuse to play AI computer program (because it’s too good). Chess: 1997: Deep Blue (IBM) beat world champion Gary Kasparov 2005: a team of computers (Hydra, Deep Junior and Fritz), wins 8.5-3.5 against a rather strong human team formed by Veselin Topalov, Ruslan Ponomariov and Sergey Karjakin, who had an average ELO rating of 2681. 2006: The undisputed world champion, Vladimir Kramnik, is defeated 4-2 by Deep Fritz.

The History of AI in games (2) Backgammon: – TD-Gammon (IBM) is world champion amongst humans and computers Go: – Human champions refuse to play top AI player (because it’s too weak) Bridge: – Still out of reach for AI players. Why ? Others : ???

Types of Games Perfect vs. Imperfect information: Perfect: See the exact state of the game e.g. chess, backgammon, checkers, go, othello Imperfect: Information is hidden e.g. scrabble, bridge, most card games Deterministic vs Stochastic: Deterministic: Change in state is fully determined by player move. e.g. chess, othello Stochastic: Change in state is partially determined by chance. e.g. backgammon, monopoly

Types of Game Deterministic Stochastic admissible, perfect info Checkers, Chess, Go, Othello Backgammon, Monopoly not admissible, imperfect info ??? Bridge, Poker, Scrabble

Game playing as a search We can model game playing as a search in a state space as we did with other problems before. In order to model a game into a search problem we need to decide the states, operator, initial state, goal, and utility function

Game Playing as a search Consider a two player board game: e.g., chess, checkers, tic-tac-toe board configuration: unique arrangement of "pieces“ Representing board games as search problem: states: board configurations operators: legal moves initial state: current board configuration terminal state: winning/terminal board configuration utility function: values for terminal state (win: +1, loss: -1, draw: 0) We want to find a strategy (i.e. way of picking moves) that wins the game.

Game playing complexity Assume the opponent’s moves can be predicted given the computer's moves How complex would search be in this case? Worst case: O(bm) branching factor, max depth Tic-Tac-Toe: ~5 legal moves, max of 9 moves 59 = 1,953,125 states Chess: ~35 legal moves, ~100 moves per game bd ~ 35100 ~10154 states, “only” ~1040 legal states Common games produce enormous search trees

Game tree representation The Problem is that the enemy will not do exactly as we planned, in fact the enemy will try to do the best move for it and thus creating the worst move for the player How do we deal with this ?

Search Tree review Search Tree ? How do we implement the search tree ??

The minimax algorithm Expand complete search tree in DFS manner, until terminal states have been reached and their utilities computed. Computer favors high utility value and the opponent favors low utility value. Computer will choose the moves that maximize the utility value. Go back up from leaves towards the current state of the game. At each min node: backup the worst value among the children. (opponent’s move) At each max node: backup the best value among the children. (computer’s move)

Minimax consists of 5 steps. Generate the complete game tree. Apply the utility function to all the terminal states. Use the utility of the terminal states to calculate a utility value for their parents (either max or min) depending on depth. Continue up to root node. Choose move with highest value from root node.

How about this ? The utility function is only applied to terminal nodes. If max makes move A1 then Min should make move A11. Thus the result of making move A1 is a value of 3 for the utility function. Similarly A2 leads to a value of 2 and A3 a value of 2. Max wants to maximise the utility function and so A1 is the best move to make.

Minimax Decision

Minimax Algorithm Complete ? Only if tree is finite. NB a finite strategy can exist even in an infinite tree Optimality ? Yes, against an optimal opponent. (Otherwise we don’t know) Time Complexity ? O(bm) Space Complexity ? O(bm) (depth-first exploration) Why not use Minimax to solve Chess ? For chess, b  35, m  100 for “reasonable” games exact solution completely infeasible But do we need to explore every path?

Resource limitation ? Suppose we have 100 seconds to make a move, and we can search 104 nodes per second. So we can only search 106 nodes per move (Or even fewer, if we spend time deciding which nodes to search.) Standard approach: Use a cutoff test instead of terminal test (e.g. based on depth limit) Use an evaluation function instead of utility function for the nodes where we cutoff the search.

The evaluation function An evaluation function v(s) represents the “goodness” of a board state (e.g. chance of winning from that position). • If the features of the board can be evaluated independently, use a weighted linear function: v(s) = w1f1(s) + w2f2(s) + … + wnfn(s) = (where s is board state) • More important features get more weight • This function can be given by the expert or learned from experience.

The evaluation function w1 = 9; f1(s) = (number of white queens) – (number of black queens) w2 = 3; f2(s) = (number of white knights) – (number of black knights) w3 = 1; f3(s) = (number of white pawns) - (number of black pawns) The quality of play depends directly on the quality of the evaluation function

The evaluation function : precision? Evaluation function is only approximate, and is usually better if we are close to the end of the game. • Move chosen is the same if we apply a monotonic transformation to the evaluation function. • Only the order of the numbers matter: payoffs in deterministic games act as an ordinal utility function. =

Latihan Penjadwalan Kelas (CSP) Diberikan sebuah pen jadwalan kelas sebagai berikut: ada 4 kelas (C1,… ,C4), dan 3 ruangan (R1, .., R3). Terdapat penjadwalan sebagai berikut:   Terdapat pembatasan sebagai berikut: Setiap kelas harus menggunakan salah satu dari ketiga ruangan yang tersedia R3 terlalu kecil untuk C3 R2 dan R3 terlalu kecil untuk C4

Latihan Penjadwalan Kelas (CSP) Variabel dan domain apa saja yang dapat diberikan untuk problem penjadwalan tersebut? Tunjukkan kemungkinan isi nilai untuk setiap variabel sesuai dengan constraints di atas. Ekspresikan constraints problem secara formal.

Jawaban CSP Penjadwalan (1) Variabel: C1, C2, C3, C4; Domain: R1, R2, R3 Kemungkinan alokasi variabel dari domain C1: { R1, R2, R3 } C2: { R1, R2, R3 } C3: { R1, R2 } C4: { R1 }

Jawaban CSP Penjadwalan (2) Constraints yang ada: Kelas tidak boleh ada yang bentrok C1 != C2, C1 != C3, C2 != C3, C2 != C4, C3 != C4 Pembatasan kapasitas ruangan C3 != R3, C4 != R2, C4 != R3 Berikan sekarang solusinya  (manfaatkan constraints graph)

Jawaban CSP Penjadwalan (3) Constraints graph C1 C2 C3 C4 time r1 r2 r3

Latihan Tic-Tac-Toe (minmax) Diberikan sebuah situasi permainan seperti di bawah ini:

Latihan Tic-Tac-Toe (minmax) X (max player) sedang dalam giliran untuk melanjutkan permainan. Berikan semua situasi berikutnya yang mungkin untuk X Pilihlah jalur yang tepat sesuai dengan algoritma minmax, jika diketahui fungsi utilitas untuk situasi menang untuk X = +10, kalah = -10, dan draw = 0.

Jawaban Tic-Tac-Toe