Title: Adaptive middleware for context-aware applications in smart-homes
1Adaptive middleware forcontext-aware
applications in smart-homes
MPAC 04
- Markus Huebscher
- Imperial College London
2Outline
- Middleware
- Structure of middleware
- Utility functions on QoC attributesfor service
selection and adaptation - Utility functions
- Example Euclidean distance
- Learning
- Non-context aware service selection
3Smart Homes
- Augment home with sensors
- Support individuals with health problems
- Elderly living alone at home
- Patients with heart condition
- Improve lifestyle
- Smart fridge keeps track of items in fridge
- Smart phones ring only in room where addressee is
present
4Context-aware applications
Application
Application
Middleware
e.g. user in living room sitting on sofa,
room bright, no noise, etc.
Context
Sensor datalogic
Collect AggregateInterpret
e.g. user at location (x,y), light and
sound values, etc.
PhysicalSensor
Sensors
5Approach
- Self-adaptive (autonomic) middleware for context
provision. - Context providers advertise their capabilities
with Quality of Context (QoC) attributes. - E.g. precision, refresh rate, spacial coverage
- Assume gt1 alternatives for same context.
- location ultrasonic, RFID, IR, smart floor,
visual - gait visual, wearable accelerometers
- Middleware receives app-specific utility function
to rate context providers using QoC attrs. - Given multiple alternatives, middleware selects
one that maximises app satisfaction
6Middleware context structure
Applications
App1
App2
ContextService
Context ProvisionAdaptation
ContextProvider2
ContextProvider1
ContextProvisioning(aggregation
interpretation)
Sensors2
Sensors3
Sensors
Sensors1
7Provider advertisement
App1
App2
ContextService
advertQoC attrs
ContextProvider2
ContextProvider1
Directory Service
Sensors2
Sensors3
Sensors1
8Provider advertisement
- CP sends advert msg to DS.
- Context type
- QoC attributes
- Precision/Probability of correctness
- refresh rate
- If advert successful periodically send heartbeat
to DS - Implicitly tells DS that CP still alive
- Provide updated values for QoC attrs
9Consumer advertisement
App1
App2
Request context typeUtility function
ContextService
ContextProvider2
ContextProvider1
Directory Service
Sensors2
Sensors3
Sensors1
10Consumer advertisement
- Request context type to SD
- Provide Utility function
- Given QoC attrs of a CP, determines how desirable
CP is. - Application-specific measure of QoC.
- Delegate to middleware task of adapting to best
alternative
11Middleware adaptation structure
App
Util Fct evaluation
ContextService
Call for adaptation
Fires events
ContextProvider2
ContextProvider1
Directory Service
CPs register at DS and regularly send heartbeat
to DS(Im alive) providing updated QoC attrs.
Sensors2
Sensors3
Sensors1
12Auto update (self-configuring)
Application
Util Fct evaluation
ContextService
3. switch to CP2
2.eventnew CP
4.
ContextProvider1
1.advertise
Directory Service
Sensors2
Sensors1
13Failure recovery (self-healing)
Application
Util Fct evaluation
ContextService
3. switch to CP1
2.eventCP2 failure
4.
ContextProvider2
ContextProvider1
1.noheartbeat
Directory Service
Sensors2
Sensors3
Sensors1
14QoC change (self-optimising)
Application
Util Fct evaluation
ContextService
3. switch to CP1
2.eventCP2 QoCdegradation
4.
ContextProvider2
ContextProvider1
1.hearbeatwith QoCdegradation
Directory Service
Sensors2
Sensors3
Sensors1
15Utility Functions
- Map QoC attrs of CP to desirability of CP
- Example Euclidian distance
- Computes distance between a desirable point in
the QoC-space and the CPs QoC point or the
origin of the QoC-space. - Many choices as to how utility evaluated
16Euclidean distance example
precision
CP2
CP1
CP3
ref
refresh rate
17Euclidean distance example
precision
Frequently-lost-objects finder
CP2
CP1
CP3
ref
Set weight for each dimension
Light-control system
refresh rate
18Euclidean distance example
precision
CP1
ref
CP3
CP2
refresh rate
19Euclidean distance examplein Functional
Programming Language
- utilFct_Euclid (QoC,Double) -gt Double
- utilFct_Euclid pQoC
- let
- myQoC (Precision,40),(RefreshRate,10)
- in
- computeNorm (distance pQoC myQoC)
- computeNorm Double -gt Double
- computeNorm d
- allDistancesPositive d euclidNorm d
- True negEuclidNorm d
20Euclidean distance examplein Functional
Programming Language
- -- Takes CP's QoC, App's QoC and computes
difference for each dimension - distance (QoC,Double) -gt (QoC,Double) -gt
Double - distance
- distance ((xId,xValue)xs) ((yId,yValue)ys)
- xId yId (xValue - yValue) distance xs
ys - xId / yId distance ((xId,xValue)xs) (ys
(yId,yValue)) - -- Returns True iff all values in the input list
are gt0 - allDistancesPositive Double -gt Bool
- allDistancesPositive (xxs) x gt 0
allDistancesPositive(xs) - allDistancesPositive True
21- -- Returns normal Euclidian norm
- euclidNorm Double -gt Double
- euclidNorm d
- let
- euclidNorm2 Double -gt Double -gt Double
- euclidNorm2 n sqrt n
- euclidNorm2 (xxs) n euclidNorm2 xs (n x2)
- in
- euclidNorm2 d 0.0
- negEuclidNorm Double -gt Double
- negEuclidNorm d
- let
- negEuclidNorm2 Double -gt Double -gt Double
- negEuclidNorm2 n -1 sqrt n
- negEuclidNorm2 (xxs) n
- x lt 0 negEuclidNorm2 xs (n x2)
- x gt 0 negEuclidNorm2 xs n
- in
22Computing distancewith different measurement
units
- Problem Have to sum values with different units,
e.g. 1/metres with Hz. - Solution Standardise scale of each dim.
- Manually pick a sensible scaling factor for each
Quality of Context - Tedious, subjective.
- Automated scaling factor Mahalanobis distance
- For each QoC Attr
- Compute Std Dev over all available CPs
- Express distance of attr as multiple of Std Dev?
apply scaling factor 1/si
23Learning consumers utility fct
- If consumer does not provide Util Fct
- E.g. not supported (resource-constrained)
- Can learn to predict consumers satisfaction with
CPs (just yes/no) - Middleware chooses CP, consumer sends /-
feedback about CP. - Relevance-based decision tree learning
- Takes as input the set of QoC attributes
- Predict whether consumer will like a CP (yes/no)
24Relevance-based decision tree learning
precision
refresh rate
10
lt10
precision
no
CP2
CP3
CP1
40
lt40
CP4
ref (10,40)
yes
no
refresh rate
25Relevance-based decision tree learning 2
precision
refresh rate
lt10
10
CP4
precision
precision
CP2
CP3
20
lt40
40
lt20
CP1
yes
yes
yes
no
no
refresh rate
26The problem of trust
- Trust CP to deliver context info according to
advertised QoC attributes. - Trustworthiness (tw) is a QoC attribute
determined by middleware, not CP - Use praise/complaint feedback from. consumers
after CP use to determine tw. - Bayesian parameter learning
- Number of /- feedbacks? probability
distribution for CP tw. - tw a QoC attribute.
- Consumer decides how much risk to take in the
hope of good QoC.
27Non-context applicationsExample printer service
- App (eg on PDA) wants to find nearest printer.
- Predefined utility function uses a map to
determine nearest printer. - App selects nearest util fct in middleware
- App neednt know topology of building
- Apps printers only need to know their location,
middleware does the rest.
P1
P2
U
28Non-context applicationsExample printer service
2
- Other utility functions
- Shortest printing time
- depends on print queue length and printer speed
- adapt printer selection if paper jams, no toner.
- Best quality
- Resolution, colour, type of paper? Tree-based
classification - Utility functions generally useful for service
selection and adaptation when alternative
providers can be ranked - On service failure, automatically switch to next
best alternative
29Thank you