Reasoning Support for Risk Prediction and Prevention in Independent Living 21 criterion(4,L,T) :- location(L,T).

| %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Optimization using criterias %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% signal(P) :- sensed(rssi,P,L,T). signal_data(N) :- count_s(N,L,T). count_s(N,L,T) :- N = [sensed(S,L,T) : sensed_type(S)=1], location(L,T), not has_rssi(T). reward(L,T,N) :- not has_rssi(T), has_data(T), count_s(N,L,T). sense_power(P,T,C) :- sensed(rssi,P,L,T), criterion(C,L,T). sense_num(N,T,C) :- count_s(N,L,T), sensed(S,L,T), criterion(C,L,T). best_value(C,B,T) :- criterion(C), time(T), signal(B), B = #max [sense_power(P,T,C):signal(P)=P], not best_value_p(D,T) : criterion(D): D<C. best_value(C,B,T) :- criterion(C), time(T), signal_data(N), B>=0, B = #max [sense_num(N,T,C):signal_data(N) = N], not best_value_p(D,T) : criterion(D): D<C. best_value_p(C,T) :- best_value(C,B,T). best_location(L,T) :- best_value(C,B,T), sensed(rssi,B,L,T). best_location(L,T) :- best_value_p(C,T), sensed(S,L,T), not has_rssi(T).   |
| |

## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Generate and Test
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1 { at(L,T) : location(L) } 1 :- time(T).

:- at(L,T), not best_location(L,T).

\#hide. \#show at/2.

Besides localization, context interpretation is in charge of understanding basic beaviours that may be important for health assessment, such as the night activity. In the following subsection we illustrate how this is obtained and used in the following reasoning step.

## 4.2 Context-Aware Health Evaluation

At each reasoning cycle, results of the context interpretation process are used to infer consistent evaluations of indicators and items, combining specific logic rules with medical inputs and results of data aggregation. The evaluation process produces both an absolute evaluation and a differential evaluation (with respect to results of the previous inference cycle). Admissible values for each indicator and item are part of the medical knowledge and are encoded in the system, while their differential evaluation has four possible outcomes: worsening, improvement, no substantial change, undefined.

In general, absolute evaluation of items is available only as inputs from caregivers according to results of a specific tests. As for indicators, their absolute evaluations can be based on i) results of specific evaluation by clinicians (e.g. hearing function-