Knowledge-based Systems
description
Transcript of Knowledge-based Systems
Knowledge-based Systems
Configuration (Διαμόρφωση)
Some slides are by Lora Aroyo
Knowledge-intensive Tasks
Knowledge-intensive task
Analytic task Synthetic task
Classification
DiagnosisAssessment
Prediction
Monitoring
Assignment
Planning
Scheduling
Design
Modeling
Adopted from Speel, et al, 2001
Configuration
Configuration Input
Given/Input: a fixed, pre-defined set of components/parts, described
by: a set of properties ports for connecting it to other components constraints at each port that describe the components that
can be connected at that port, and other structural constraints
description of the desired configuration = requirements (specification of desired functionality)
criteria for making optimal selections (possible combinations)
Configuration Output
To build/Output: One or more configurations (combinations of
the parts) that satisfy all the requirements (specification)
configuration = set of components (parts) and a description of the connections (combinations) between the components in the set
detect possible inconsistencies in the requirements
Definition of Configuration
Given: Specification (of desired functionality) =
requirements Possible parts = components Possible combinations
Find: A combination of the parts (= configuration)
which satisfies the specification A search problem
Configuration Example
Building a software system from modules: ComponentsComponents = the modules
Ports = the variables (need values or provide values)
ConstraintsConstraints = descriptions of the number and types of values needed
ConstraintsConstraints = constraints about the compatibility of one module with another
Description of the desired configurationconfiguration = user's description of what the software system is supposed to do
Example – T-shirt configuration
The configuration of a T-shirt requires that we specify: the size (small, medium, or large) the print (``Men in Black'' - MIB or``Save the
Whales'' - STW) the color (black, white, or red)
There are the following rules: If the small size is chosen then the STW print
cannot be selected If the MIB print is chosen then the black color has
to be chosen as well If the STW print is chosen then the black color
cannot be selected.
Configuration: Examples
Physical products: Computer parts Elevators Kitchens Trucks Etc.
Non-physical products: Insurance packages Investment policies Real estate assignments (user profiling) Medical recipes …
Configuration Example
AA BB
AA BB
AA BBAA
BB
AA BB
Configuration-1
Part-1
Part-2Part-1-1
Part-1-2
Part-1-3
Παράδειγμα Διαμόρφωσης
Διαμόρφωση ενός εξαρτήματος για ένα υπολογιστικό σύστημα
A DCB
Εξάρτημα συστήματος
A-1 A-2 B-1 B-2 C-1 C-2 D-1 D-2
Τα A,B,C,D ή συνδυασμοί τους προσδιορίζονται από τις απαιτήσεις του πελάτη για την υλοποίηση του εξαρτήματος. Το καθένα μπορεί να υλοποιηθεί με δύο τρόπους
Παράδειγμα Διαμόρφωσης
Τμήμα Απαιτούμενα εξαρτήματα
A-1 2 τύπου B
A-2 3 τύπου B
B-1 2 τύπου C
B-2 -
C-1 -
C-2 -
D-1 1 τύπου B, τύπου 2 C
D-2 1 τύπου C-1
Πίνακας κανόνων / περιορισμών
Παράδειγμα Διαμόρφωσης
Προδιαγραφές πελάτη: {A,D}
A
A-1 A-2
2B 3B
2B-1 2B-2 1B-1,1B-2 3B-1 …
4C 2C
4C-1 … 2C-1 …
D
D-1 D-2
2C C-1
B-1 B-2
2C
2C-1 …
2C-1 …
B
επιλογέςαπαιτήσεις
Configuration aspects
one cannot design new components during the configuration task
each component is restricted in advance to only be able to "connect" to other certain components in fixed ways (i.e., they can't be modified to get arbitrary
connectivity)
the solution specifies both the components in the configuration & how they are related
Design (generalization of config.)
Design = complex task with several logical parts: functionality system type general types of components configuration of types of components actual components values of the attributes of those
components
Design (generalization of config.)
Configuration is a special case of designIn design:
- set of possible parts - not fixed in advance- possible combinations - not fixed in advance
Design is typical synthetic task – with open-ended solution space
Configuration is analytic task – with closed solution space (in practice it is very large)
Use of Configuration
Flexibility in production: fast changing product range wide variety of product range Reduce stocks Build-to-order (‘a la carte’)
Flexibility to custom manufacturing economics of mass production
Configuration vs. Classification
Configuration is more difficult than classification
Classification select one class
Configuration select subset of parts; allow multiple copies of parts; select combination of the chosen parts (architecture)
Configuration models
Used as a basis for different types of tasks
Configuring ‘therapies’ part of larger diagnosis & therapy task
Configuring alternative combinations of steps for a plan Part of a planning process
Configuration
Configuration as AI problem Heuristic algorithms for finding sub-optimal solutions
Configuration as search problem Two search spaces: Selection space
Search for appropriate / compatible / optimal components
Arrangement space Search for appropriate / compatible /optimal
arrangement of the components
Configuration picture
component hierarchy
arrangement model
specifications
additional specifications
matching
refinement,expansion
abstract & partial solutions
expanded & refined solutions
Configuration Sub-tasks
Components are selected to satisfy the requirements (Selection = Selection = choosing components)
Components are placed into the configuration (Association = Association = logical relationships between components)
Evaluation = Evaluation = Compatibility Testing and Goal satisfaction testing.
Configuration = Configuration = Selection + Association + Evaluation Selection + Association + Evaluation
Configuration Implementation
Configuration implementation depends on: What and how much is knownknown about each
subtask in advancein advance How much knowledgeknowledge is used in each subtask What is the mix & ordermix & order of the subtaskssubtasks Whether knowledge from later subtasks can
be moved forwardmoved forward into earlier subtasks to prevent failures
Selection example
ensure that only compatible components are selected
if an evaluation is known then the best (optimal) set of components should be selected
Selection = Selection = Choosing Components + Compatibility TestingChoosing Components + Compatibility Testing
Configuration variation
Arrangement Arrangement = establishing specific relationships (precisely locate one component with respect to another or with respect to some reference location)
"logical relationships", used in AssociationAssociation:"next to","connected to“, etc.
Configuration = Selection + Association Configuration = Selection + Association + Arrangement + Evaluation+ Arrangement + Evaluation
Arrangement task
Configuration 1
Precise description of the positions of all three circles = arrangement 1
A B
C
Moving circles produces anotherarrangement 2
B
AC
Components Grain Size
large modules less flexible strong requirements for other modules preconfigured smaller modules less configuration needs to be done
small modules more flexibility require more configuration
Experience
how much experience is available To guide the search for combinations of modules
that satisfy the requirements build previously discovered sub-configurations
into the system search is further reduced
add heuristic knowledge prefer one module over another in a situation lowering the chance of backtrack & remake this
decision allows to do things in previously successful order
Configuration as a CSP
design & configuration problems formulated as constraint satisfaction problems
If given: the pattern of connections constraints on this pattern not known components
equivalent to a crossword puzzle attempt to find a set of values for some variables which
are related by constraints configuration
a sequence of CSPs a Dynamic CSP
Example – T-shirt configuration
The configuration of a T-shirt requires that we specify: the size (small, medium, or large) the print (``Men in Black'' - MIB or``Save the
Whales'' - STW) the color (black, white, or red)
There are the following rules: If the small size is chosen then the STW print
cannot be selected If the MIB print is chosen then the black color has
to be chosen as well If the STW print is chosen then the black color
cannot be selected.
Example – T-shirt configuration
This configuration problem can be modelled as a CSP with three variables x1,x2,x3 representing size, print, and color respectively
The domains of the variables are D(x1)={small,medium,large} D(x2)={MIB,STW} D(x3)={black,white,red}
The first constraint is a binary constraint between variables x1 and x2 with allowed tuples: {<small,MIB>,<medium,MIB>,<medium,STW>,<large,
MIB>,<large,STW>} The second constraint is a binary constraint between
variables x_2 and x_3 with allowed tuples: {<MIB,black>,<STW,white>,<STW,red>}
Configuration as a CSP
used for checking compatibilities between choices (i.e. ports of components)
represent restrictions on choices "posted" to (i.e., attached to) the things they restrict, to
affect its subsequent use, such as its refinement "propagated" through configuration, to affect other
components used to record decisions not corresponding to objects in
the system restrict the set of components without deciding which (i.e.
partial choice) implement least commitment strategy (i.e. choices are
delayed to accumulate more information; avoid premature decisions)
Main configuration techniques
Generate and test Forward / Backward chaining Constraint-based search Specialized search methods
Επέκταση και διευθέτηση Σταδιακή εργασία με πρόβλεψη Πρόταση και αναθεώρηση
Επέκταση και διευθέτηση
Η μέθοδος αυτή αρχικά συγκεντρώνει τις προδιαγραφές των κύριων εξαρτημάτων
Μετά επεκτείνει τη διαμόρφωση για να συμπεριλάβει όλα τα απαιτούμενα εξαρτήματα
Μετά διευθετεί (τοποθετεί) τα εξαρτήματα
Είναι κατάλληλη για προβλήματα όπου οι αποφάσεις επιλογής εξαρτημάτων δεν εξαρτώνται από τις αποφάσεις διευθέτησης
Επέκταση και διευθέτηση
Η επέκταση και διευθέτηση περιλαμβάνει 3 βοηθητικές διεργασίες Υπολογισμός του συνόλου των απαιτήσεων
για ένα εξάρτημα όταν δίνονται οι αρχικές προδιαγραφές
get-requirements Επιλογή των καλύτερων εξαρτημάτων από
το σύνολο των υποψηφίων get-best-parts
Προσδιορισμός της καλύτερης διευθέτησης των εξαρτημάτων
arrange-parts
Επέκταση και διευθέτηση
Αλγόριθμος Αρχικοποίησε τη λίστα εξαρτημάτων σε κενή Συγκέντρωσε τις απαιτήσεις εξαρτημάτων που αντιστοιχούν
στις αρχικές προδιαγραφές (get-requirements) Πάρε τα κύρια εξαρτήματα που αντιστοιχούν στις
απαιτήσεις εξαρτημάτων (get-best-parts) Για κάθε κύριο εξάρτημα κάνε τα ακόλουθα
Εισήγαγε το κύριο εξάρτημα στη λίστα εξαρτημάτων Πρόσθεσε τα απαιτούμενα εξαρτήματα που αντιστοιχούν στο
παραπάνω κύριο εξάρτημα (add-required-parts) Διευθέτησε τα εξαρτήματα που βρίσκονται στη λίστα
εξαρτημάτων (arrange-parts) Επέστρεψε τη λύση
Επέκταση και διευθέτηση
add-required-parts Συγκέντρωσε τις άμεσες απαιτήσεις
εξαρτημάτων που αντιστοιχούν στο συγκεκριμένο εξάρτημα (get-requirements)
Εάν υπάρχει έστω μια απαίτηση εξαρτήματος
Πάρε τα νέα εξαρτήματα που αντιστοιχούν στις απαιτήσεις εξαρτημάτων (get-best-parts)
Για κάθε νέο εξάρτημα επανέλαβε τα ακόλουθα:
Εισήγαγε το νέο εξάρτημα στη λίστα εξαρτημάτων Πρόσθεσε τα απαιτούμενα εξαρτήματα που
αντιστοιχούν στο παραπάνω κύριο εξάρτημα (add-required-parts)
Επέκταση και διευθέτηση
Η μέθοδος αυτή στηρίζεται σε προϋποθέσεις Υπάρχει συνάρτηση αξιολόγησης, η οποία
επιλέγει τα καλύτερα εξαρτήματα που ικανοποιούν τις απαιτήσεις
Η διευθέτηση των επιλεχθέντων εξαρτημάτων είναι πάντα δυνατή
Δεν υπάρχουν περιορισμοί που δε μπορούν να ικανοποιηθούν. Έτσι η επιλογή και η διευθέτηση είναι ανεξάρτητες
Τα εξαρτήματα δε διαμοιράζονται
Παράδειγμα
Διαμόρφωση εσωτερικού χώρου ενός δωματίου
Εξαρτήματα Τραπέζια, γραφεία, καρέκλες, κρεβάτια, κτλ.
Απαιτήσεις κύριων εξαρτημάτων Γραφείο 1.5x0.80, κρεβάτι 2x0.90, κτλ.
Απαιτούμενα εξαρτήματα για τα κύρια Γραφείο – καρέκλα Βιβλιοθήκη – ράφια Πόρτες – χερούλια
Προδιαγραφές δωματίου 10x5
Σταδιακή εργασία με πρόβλεψη
Η επέκταση και διευθέτηση ακολουθεί αυστηρή σειρά στη διαδικασία διαμόρφωσης Προσδιορισμός εξαρτημάτων βάση απαιτήσεων Επιλογή καλύτερων εξαρτημάτων Διευθέτηση επιλεχθέντων εξαρτημάτων
Συχνά οι παραπάνω διεργασίες αλληλεξαρτώνται Π.χ. η διαμόρφωση ενός σύνθετου συστήματος
μπορεί να απαιτεί το διαχωρισμό της διεργασίας σε μικρότερα τμήματα
Σταδιακή εργασία με πρόβλεψη
Η σταδιακή εργασία με πρόβλεψη χωρίζει τη διαδικασία διαμόρφωσης σε μικρότερα τμήματα εργασιών (subtasks) Η κάθε υποεργασία περιλαμβάνει μια
μικρότερη διαδικασία διαμόρφωσης Οι υποεργασίες εκτελούνται σε κάποια σειρά ή
ανεξάρτητα ανάλογα με τις αλληλεπιδράσεις Η τεχνική αυτή χρησιμοποιείται όταν οι
αλληλεπιδράσεις μέσα στις υποεργασίες είναι πολύ πιο ισχυρές από ότι μεταξύ διαφορετικών υποεργασιών
Σταδιακή εργασία με πρόβλεψη
Αλγόριθμος Αρχικοποίησε τη λίστα εξαρτημάτων σε κενή Συγκέντρωσε τις απαιτήσεις εξαρτημάτων που αντιστοιχούν
στις αρχικές προδιαγραφές (get-requirements) Πάρε τα κύρια εξαρτήματα που αντιστοιχούν στις
απαιτήσεις εξαρτημάτων (get-best-parts) Βάση των απαιτήσεων δημιούργησε υποεργασίες Όσο υπάρχουν υποεργασίες που δεν έχουν εκτελεστεί
Έλεγξε τις συνθήκες που πρέπει να πληρούνται για να ξεκινήσει η εκτέλεση κάποιας υποεργασίας και επέλεξε μια υποεργασία
Εκτέλεσε την εργασία καλώντας την αντίστοιχη διαδικασία
Επέστρεψε τη λύση
Σταδιακή εργασία με πρόβλεψη
Για την εκτέλεση κάθε υποεργασίας πρέπει να υπάρχει μια διαδικασία διαμόρφωσης Υλοποιημένη με οποιαδήποτε τεχνική χρειάζεται
Η σταδιακή εργασία με πρόβλεψη μπορεί να αντιμετωπίσει προβλήματα από αλληλεπιδράσεις λόγω διαμοίρασης εξαρτημάτων Αν δύο οι περισσότερες υποεργασίες εκτελεστούν
παράλληλα και χρειάζονται το ίδιο εξάρτημα μπορεί να κατασκευάσουν αντικρουόμενες διαμορφώσεις
Οπότε χρειάζεται κάποια πρόβλεψη κατά την εκτέλεση υποεργασιών
Σταδιακή εργασία με πρόβλεψη
Η πρόβλεψη μπορεί να αποτρέψει μελλοντικές συγκρούσεις / αδιέξοδα Κάτι ανάλογο με το forward checking και
το maintaining arc consistency σε CSPs Για να γίνουν σωστές προβλέψεις
απαιτείται εκτεταμένη ανάλυση του πεδίου εφαρμογής Η σταδιακή εργασία με πρόβλεψη είναι
πολύ domain-dependent
Παράδειγμα
Η διαμόρφωση μιας πολυκατοικίας μπορεί να χωριστεί σε ένα σύνολο υποεργασιών Διαμόρφωση κάθε διαμερίσματος, διαμόρφωση
κοινών χώρων, διαμόρφωση parking, κτλ. Υπάρχουν αλληλεπιδράσεις μεταξύ των
υποεργασιών? Αποφάσεις διευθέτησης υδραυλικών
εγκαταστάσεων, σωλήνες καλοριφέρ, κ.α.
Πρόταση και αναθεώρηση
Οι προηγούμενες μέθοδοι δεν προσφέρουν δυνατότητες εναλλακτικών επιλογών ή οπισθοδρόμησης σε περίπτωση ασυμβατότητας Η πρόταση και αναθεώρηση είναι βασισμένη
στην ικανοποίηση περιορισμών και προσφέρει αυτές τις δυνατότητες
Κατά τη διάρκεια της διαμόρφωσης ελέγχονται περιορισμοί
Αν υπάρχει παραβίαση τότε εναλλακτικές επιλογές μπορούν να δοκιμαστούν ή να αναιρεθεί η προηγούμενη επιλογή
Πρόταση και αναθεώρηση Αλγόριθμος
Αρχικοποίησε τη λίστα εξαρτημάτων σε κενή Συγκέντρωσε τις απαιτήσεις εξαρτημάτων που αντιστοιχούν στις
αρχικές προδιαγραφές (get-requirements) Πάρε τα κύρια εξαρτήματα που αντιστοιχούν στις απαιτήσεις
εξαρτημάτων (get-best-parts) Όσο δεν υπάρχει αποτυχία στις επιλογές και υπάρχουν επιλογές που
πρέπει να γίνουν Επέλεξε το επόμενο εξάρτημα στην ως τώρα μερική
διαμόρφωση για το οποίο υπάρχει αναπάντητη επιλογή Εάν υπάρχουν περιορισμοί σε σχέση με άλλα εξαρτήματα,
ενεργοποίησε τους Διευθέτησε το εξάρτημα Εάν υπάρχουν περιορισμοί που παραβιάζονται επέλεξε
εναλλακτική διευθέτηση Αν δεν υπάρχουν εναλλακτικές λύσεις οπισθοδρόμησε στην
προηγούμενη επιλογή Επέστρεψε τη λύση
Configuration Example - XCON
Πεδίο Γνώσης: διαμόρφωση υπολογιστικών συστημάτων VAX της DEC computers, ανάλογα με τις προδιαγραφές των πελατών
Κατασκευάστηκε: από την ομάδα του John McDermott, 1978 - 1981
Input: Τα ζητούμενα χαρακτηριστικά του υπολογιστικού συστήματος
Output: Διαμόρφωση του υπολογιστικού συστήματος
Configuration Example - XCON
XCON σύστημα για τη διαμόρφωση υπολογιστικών συστημάτων της DEC
Λειτουργία: Συλλογή προδιαγραφών από τον χρήστη Έλεγχος πληρότητας / προσθήκη εξαρτημάτων /
απαιτήσεις και συμβατότητα λογισμικού Προσδιορισμός cpu, RAM, δίσκων, κτλ. Χωρική διευθέτηση εξαρτημάτων, απαιτήσεις σε
ρεύμα καλώδια κτλ.
Το XCON διαθέτει ΒΔ με 31000 εξαρτήματα 40 τύποι εξαρτημάτων με 40 χαρακτηριστικά για
καθένα περίπου
Configuration Example - XCON
Αναπαράσταση Γνώσης: Production rules.
Inference engine: Σταδιακή εργασία με πρόβλεψη και forward chaining για τη διαμόρφωση των υποεργασιών
Χειρισμός ασάφειας/αβεβαιότητας: Όχι: το σύστημα απλά κατασκευάζει μια λύση, που υποτίθεται ότι είναι ικανοποιητική
Configuration Example - XCON
Χαρακτηριστικά ΤιμέςΚωδικός RK11-EA
CLASS BUNDLE
TYPE DISK DRIVE
SUPPORTED YES
COMPONENT LIST 1 070-12292-25
1 RK07-EA
1 RK611
Configuration Example - XCON
Παράδειγμα κανόνα IF the most current active context is assigning a
power supply AND a unibus adapter has been put in a cabinet AND the position it occupies in the cabinet is known AND there is space available for a power supply AND there is an available power supply AND there is no H7101 regulator available THEN add an H7101 regulator to the order
Configuration Example - XCON
Η λειτουργία του XCON περιλαμβάνει 6 κύρια στάδια και εκατοντάδες υπο-στάδια ή εργασίες που ανήκουν σε μια ιεραρχία Το 1ο στάδιο προσθέτει απαραίτητα εξαρτήματα
που λείπουν σύμφωνα με τις προδιαγραφές Τα στάδια 2 και 3 τοποθετούν τα εξαρτήματα Το στάδιο 3 τοποθετεί τα όργανα ελέγχου Το στάδιο 5 παράγει σχεδιάγραμμα του
συστήματος Το στάδιο 6 παράγει τις καλωδιώσεις
υπολογίζοντας τις αποστάσεις μεταξύ συσκευών
Configuration Example - XCON
Το XCON χρησιμοποιεί τη μέθοδο σταδιακής εργασίας με πρόβλεψη Καθένα από τα 6 στάδια αναλύεται σε
εργασίες όπου υπάρχει ισχυρή αλληλεπίδραση μεταξύ των ενεργειών
Κατά την εκτέλεση κάθε εργασίας γίνεται πρόβλεψη για αποφυγή πιθανές ασυμβατότητες
Έτσι αποφεύγεται η ανάγκη για οπισθοδρόμηση
R1/XCON
Significance: A rather simple forward-chaining rule-based expert system, which nevertheless performed well, solved a difficult manufacturing problem, and proved to be enormously profitable.
R1/XCON
Digital Equipment Corporation's problem was that they were marketing the best-selling Vax-11 series of computers, and the department responsible for configuration was failing to keep up with customer demand.
R1/XCON
Each computer was the result of a consultation between a sales executive and the customer, designed to discover the customer's requirements, after which a configuration was drawn up, from which the system was built.
R1/XCON
Each configuration was taking 25 minutes, and orders were arriving at a rate of 10,000 a year.
There was a high level of errors in the configurations produced.
R1/XCON
DEC attempted to write a conventional program to do this task, with no success, then invited McDermott to write an AI system to do it. McDermott wrote R1/XCON.
By 1986, it had processed 80,000 orders, and achieved 95-98% accuracy. It was reckoned to be saving DEC $25M a year.
R1/XCON
However, R1/XCON suffered from the shortcomings of simple production-rule-based systems. When the nature of the task changed,
fresh rules were simply added at the end of the rulebase.
Soon, the rulebase was very large, unreliable and incomprehensible.
Expensive rewriting was needed to restore the operation of the system.