# Deliberative and Conceptual Inference in Service Robots
## 6 Non-Monotonic Knowledge-Base Service
If so, \(o_{i}\) is added to the list \(L_{final}\) of final objects to be delivered. Otherwise, the preferred object to be served \(o_{pref}\) of the class under consideration \(C_{o_{i}}\) is obtained, and the user is queried to choose between the object he originally asked for \(o_{i}\) and the preferred one \(o_{pref}\). The user's choice is added to \(L_{final}\). It can be noticed that getting the preferred member of a class \(C\) is an important operation. Recall that preferences are conceived as conditional defaults bound to their weight, so the lower the weight the higher its preference. The steps involved in finding the preferred value of a property or relation defined in the class \(C\) are:

1. Retrieve from the KB the list of conditional defaults defined within \(C\) and its ancestor classes. 2. Let \(\ell_{sorted}\) be the result of sorting in increasing order the list generated in the previous step. The key to sort this list is the weight value defined within the conditional defaults. 3. For each conditional default in \(\ell_{sorted}\), verify if its antecedents are satisfied. In that case, keep its consequent, which is a property or relation. Otherwise, dismiss the conditional default. Then, delete from left to right consequents that define a propertyor relation more that once, preserving the first occurrence. Let \(\ell_{dd}\) be the list that is obtained after this deletion. 4. In \(\ell_{del}\), find the property or relation of interest in which value is the desired output. For the situation described above, the preferred object is sought as the argument of the property _to serve_, occurring in the consequent of the conditional defaults present in the class \(C_{o_{i}}\). Interestingly, the robot can adequately deal with user commands that are underspecified, i.e., commands asking for an individual object but missing specific information that uniquely identifies it, providing instead general information. For instance, _bring me something to drink_. The robot deals with this kind of commands by taking the preferred individual of the class being asked. Therefore, at the end of the speech act, whether the user requests objects by name or by giving general information, the robot is able to formulate the final list \(L_{final}\) of objects to be fetched to the user. ### Fetching and Delivering Items

For each \(o_{i}\in L_{final}\), the robot queries the KB to retrieve the list \([loc_{1},\ldots,loc_{n}]\) of preferred locations where \(o_{i}\) is likely to be found, such that \(loc_{1}\) is the most preferred location and \(loc_{n}\) is the least preferred location. Furthermore, \([loc_{1},\ldots,loc_{n}]\) is a permutation of the locations \(l_{1},\ldots,l_{n}\) in \(L\) (see the settings of the conceptual inference in Section 9). Obtaining the list of preferred locations of an object is an operation closely related to the operation outlined above that finds the preferred member of a class. The steps are:

1. retrieves not only the conditional defaults of the object's class and its ancestors, but also the conditional defaults of the object itself. 2. is the same of that to find the preferred member of a class. 3. keeps the consequent of conditional defaults in which antecedents are satisfied but does not delete any of them, although a property or relation may be defined multiple times. 4. subtracts in order all the values of the property or relation of interest, thus producing the desired list. For the list of preferred locations needed by the robot, the property of interest in step 4 is the location, or \(loc\) as it is defined in the KB. Next, the robot visits the shelves at the locations \([loc_{1},\ldots,loc_{n}]\) in their order of appearance, searching for the object \(o_{i}\) in each of them. If the object \(o_{i}\) is found at \(loc_{j}\), the robot takes it, and repeats now the process for the object \(o_{i+1}\) in \(L_{final}\). If \(o_{i}\) is not found at \(loc_{j}\), the robot searches for it in the shelf located at \(loc_{j+1}\).