Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Design
Rule 1
IF Boiler temprature>300
AND Boiler water level>5
THEN Boiler condition normal
Rule 2
IF Boiler pressure<50
AND Boiler water level>3
THEN add water to boiler
Rule-based system:
Unrelated facts scattered throughout the knowledge base
Frame-based system:
Collects the related facts
Represents them as slots within a single frame structure
Frame Boiler
Temprature
Pressure
Water level
Condition
IF
<Boiler>.Temprature > 300
AND <Boiler>.Water_level > 5
THEN <Boiler>.Condition = normal
Solution:
- We have 3 rooms: living room, kitchen, bedroom
- It can be extended
- Each room has a cooling and heating unit, and a thermostat
- Rooms can be occupied or unoccupied
Infrared Senor
50
60
70
Setting
Temperature
50
60
70
Mode
Heat
Furnace
Air
Air conditioner
Objects
Room ,
Furnace, Air conditioner,
Thermostat, Room temperature,
Sensor
Object features
ROOM Features
Thermostat
Furnace
AC
Sensor
occupancy
FURNACE
Room
State
Thermostat
THERMOSTAT
Room
Furnace
AC
Sensor
Mode
Setting
temperature
Sensor
Occupancy
Room
Thermostat
Events
Thermostat mode of operation for each room is either
heat or cool
When a given room is occupied, temperature should be
adjusted toward the thermostat setting
When a given room is unoccupied, and operation mode
is heat, then room temperature should be adjusted
toward the thermostat setting minus 5 degree
When a given room is unoccupied, and operation mode
is cool, then room temperature should be adjusted
toward the thermostat setting plus 5 degree
Architecture
Generalization
Aggregation
Association
: Kind of relationship
: Part of relationship
: Semantic relationship
Thermostat
Thermostat 1
Thermostat 2
Thermostat 3
Room
Livingroom
Kitchen
Bedroom
Class name:
Properties:
Room
Furnace
Occupancy
Thermostat
AC
Methods:
Unoccupied
Class name:
Thermostat
Furnace
Properties:
AC
Mode
Heat
Setting
68
Temperature
65
Room
Methods:
Class name:
AC
Properties:
Room
State
Thermostat
Methods:
off
Room instances:
we have 3 rooms and we need to create
instances .
Room
Livingroom
Furnace
Furnace1
Kitchen
Furnace
Furnace2
Bedroom
Furnace
Furnace3
occupancy unoccupied
occupancy unoccupied
occupancy unoccupied
thermostat thermostat1
thermostat thermostat2
thermostat thermostat3
AC
AC1
AC
AC2
AC
AC3
Advantages of rules
- takes a set of evidence and inferes new informaion
- deep inferencing: general information
- using variables, all instances are scanned
Disadvantages of rules
- an inefficient means for capturing knowledge that is
largely procedural
- limited in the type of functions they can perform
- quickly become unreadable and difficult to maintain
- difficult to write a set of rules that account for the
propagation of changes in information
a large
IF-NEEDED
IF-CHANGED
Class name:
Thermostat
IF-CHANGED
Properties:
Methods:
Mode
heat
Unit-Control
Setting
68
Unit-Control
Temperature
65
Unit-Control
Air
Self:Mode=Air;
Heat
Self:Mode=Heat;
Init
forAll (x|Thermostat)
|ResetValue(x:setting);
RestValue(x:mode);
ResetValue(x:Temperature);
Class name:
Thermostat
Methods:
Body:
Unit-Control
{
If ((Self:Temprature <Self:Setting) And
(Self:Furnace:State #= OFF) And
(Self:Mode #= Heat) And
(Self:Room:Occupancy #=Occupied))
Then SendMessage (Self:Furnace,ON);
If .
Then ..;
If .
Then ..; };
Furnace
Class name:
IF-CHANGED
Room
State
OFF
Heat
Thermostat
Methods:
Name
Body
OFF
SetValue (Self:State,OFF)
ON
SetValue (Self:State,ON)
Init
resetvalue
Heat
While((Self:State #=ON))
Self:Thermostat:Temperature == +1
Trace of operation
1.
2.
3.
4.
5.
Broadening knowledge
Addition of new events or objects
ones