Human-in-the-Loop Synthesis for Partially Observable Markov Decision Processes
Steven Carr Nils Jansen Ralf Wimmer Jie Fu Ufuk Topcu

Aldebaran b's temperate past uncovered in planet search data
    [
    December 30, 2023
============================================================

empty
empty


We study planning problems where autonomous agents operate inside environments
  that are subject to uncertainties and not fully observable. 
Partially observable Markov decision processes (POMDPs) are a natural formal model to capture such problems.
Because of the potentially huge or even infinite belief space in POMDPs, synthesis with safety guarantees is, in general, computationally intractable. 
We propose an approach that aims to circumvent this difficulty: in scenarios that can be partially or fully simulated in a virtual environment, we
  actively integrate a human user to control an agent. 
While the user repeatedly tries to safely guide the agent in the simulation, we collect data from the human input.
Via behavior cloning, we translate the data into a strategy for the POMDP.
The strategy resolves all nondeterminism and non-observability of the POMDP, resulting in a discrete-time Markov chain (MC).
The efficient verification of this MC gives quantitative insights into the quality of the
  inferred human strategy by proving or disproving given system specifications.
For the case that the quality of the strategy is not sufficient,
  we propose a refinement method using counterexamples presented to the human. 
Experiments show that by including humans into the POMDP verification loop we improve the state of the art by orders of magnitude in terms of scalability.




§ INTRODUCTION



We aim at providing guarantees for planning scenarios given by dynamical systems with uncertainties and partial observability.
In particular, we want to compute a strategy for an agent that ensures certain desired behavior <cit.>.

A popular formal model for planning subject to stochastic behavior are Markov decision processes (MDPs).
An MDP is a nondeterministic model in which the agent chooses to perform an action under full knowledge of the environment it is operating in.
The outcome of the action is a probability distribution over the system states.
Many applications, however, allow only partial observability of the current system state <cit.>.
For such applications, MDPs are extended to partially observable Markov decision processes (POMDPs).
While the agent acts within the environment, it encounters certain observations, according to which it can infer the likelihood of the system being in a certain state.
This likelihood is called the belief state.
Executing an action leads to an update of the belief state according to new observations.
The belief state together with the update function form a (possibly infinite) MDP, commonly referred to as the underlying belief MDP <cit.>.



As a motivating example, take a motion planning scenario where we want to devise a strategy for an autonomous agent accounting for both randomly moving and static obstacles.
Observation of these obstacles is only possible within a restricted field of vision like in Fig. <ref>.
The strategy shall provably ensure a safe traversal to the goal area with a certain high probability.
On top of that, the expected performance of the agent according to the strategy shall encompass taking the quickest possible route.
These requirements amount to having quantitative reachability specifications like “The probability to reach the goal area without crashing into obstacles is at least 90 %” and expected cost specifications like “The expected number of steps to reach the goal area is at most 10”.

Quantitative verification techniques like probabilistic model checking (PMC) <cit.> provide strategies inducing  guarantees on such specifications.
 <cit.> or Storm <cit.> employ efficient methods for finite MDPs, while POMDP verification – as implemented in a prototype <cit.> – generates a large, potentially infinite, belief MDP, and is intractable even for rather small instances.
So-called point-based methods <cit.> employ sampling of belief states.
They usually have slightly better scalability than verification, but there is no guarantee that a strategy provably adheres to specifications.

We discuss two typical problems in POMDP verification.


  * For applications following the aforementioned example, verification takes any specific position of obstacles and previous decisions into account.
More generally, strategies inducing optimal values are computed by assessment of the full belief MDP <cit.>.




  * Infinite horizon problems may require a strategy to have infinite memory.
However, randomization over possible choices can often trade off memory <cit.>.
The intuition is that deterministic choices at a certain state may need to vary depending on previous decisions and observations.
Allowing for a probability distribution over the choices – relaxing determinism – is often sufficient to capture the necessary variability in the decisions.
As also finite memory can be encoded into a POMDP by extending the state space, randomization then supersedes infinite memory for many cases <cit.>.


Here, we propose to make active use of humans' power of cognition to (1) achieve an implicit abstraction of the belief space and (2) capture memory-based decisions by randomization over choices.
We translate POMDP planning scenarios into virtual environments where a human can actively operate an agent.

In a nutshell, we create a game that the human plays to achieve a goal akin to the specifications for the POMDP scenario.

This game captures a family of concrete scenarios, for instance varying in characteristics like the agent's starting position or obstacle distribution.
We collect data about the human actions from a number of different scenarios to build a training set.
With Hoeffding's inequality <cit.>, we statistically infer how many human inputs are needed until further scenarios won't change the likelihoods of choices.
Using behavior cloning techniques from Learning-from-Demonstration (LfD) <cit.>, we cast the training set into a strategy for a POMDP that captures one specific scenario.

Such a strategy fully resolves the nondeterminism and partial observability, resulting in a discrete-time Markov chain (MC).
PMC for this MC is efficient <cit.> and proves or disproves the satisfaction of specifications for the computed strategy.

A human implicitly bases their decisions on experiences over time, , on memory <cit.>.
We collect likelihoods of decisions and trade off such implicit memory by translating these likelihoods into randomization over decisions.
In general, randomization plays a central role for describing human behavior in cognitive science.
Take for instance <cit.> where human behavior is related to quantifying the trade-off between various decisions in Bayesian decision theory.


Formally, the method yields a randomized strategy for the POMDP that may be extended with a finite memory structure.
Note that computing such a strategy is already NP-hard, SQRT-SUM-hard, and in PSPACE <cit.>, justifying the usage of heuristic and approximative methods.

Naturally, such a heuristic procedure comprises no means of optimality.
However, employing a refinement technique incorporating stochastic counterexamples <cit.> enables to pointedly immerse the human into critical situations to gather more specific data.
In addition, we employ bounds on the optimal performance  of an agent derived from the underlying MDP.
This delivers an indication whether no further improvement is possible by the human.

Besides simple motion planning, possible applications include self-driving cars <cit.>, autonomous trading agents in the stock market <cit.>, or service robots <cit.>.

We implemented this synthesis cycle with humans in the loop within a prototype employing efficient verification.
The results are very promising as both and point-based solvers are outperformed by orders of magnitude both regarding running time and the size of tractable models.

Our approach is inherently correct, as any computed strategy is verified for the specifications.



  
*Related Work
Closest to our work is <cit.>, where deep reinforcement learning employs human feedback.
In <cit.>, a robot in a partially observable motion planning scenario can request human input to resolve the belief space. The availability of a human is modeled as a stochastic sensor.
Similarly, oracular POMDPs <cit.> capture scenarios where a human is always available as an oracle.
The latter two approaches do not discuss how to actually include a human in the scenarios.
The major difference of all approaches listed above in comparison to our method is that by employing verification of inferred strategies, we obtain hard guarantees on the safety or performance.

Verification problems for POMDPs and their decidability have been studied in <cit.>.
<cit.> investigates abstractions for POMDP motion planning scenarios formalizing typical human assessments like “the obstacle is either near or far”, learning MDP strategies from human behavior in a shared control setting was used in <cit.>.
Finally, various learning-based methods and their (restricted) scalability are discussed in <cit.>.



  
*Structure of the paper

After formalisms in Sect. <ref>, Section <ref> gives a full overview of our methodology.
In Sect. <ref>, we formally discuss randomization and memory for POMDP strategies; after that we introduce strategy generation for our setting together with an extensive example.
We describe our experiments and results in Sect. <ref>.



§ PRELIMINARIES



A probability distribution over a finite or countably infinite set  is a function → with ∑_∈()=()=1. 
The set of all distributions on  is (). The support of a distribution  is
() = {x∈ | (x)>0}.



 §.§ Probabilistic Models




  
  A Markov decision process (MDP)  is a tuple  with a finite (or countably infinite) set S of states, an initial state ∈ S, a finite set  of actions, and a probabilistic transition function S×→(S).


The available actions in s∈ S are (s)={∈|(s,)∈()}.
We assume the MDP  contains no deadlock states, , (s)≠∅ for all s∈ S.
A discrete-time Markov chain (MC) is an MDP with |(s)|=1 for all s∈ S.

A path (or run) of  is a finite or infinite sequence π = s_0s_1⋯,
where s_0=, s_i∈ S, _i∈(s_i)



The set of (in)finite paths is ^ (^). 


To define a probability measure for MDPs, strategies resolve the nondeterministic choices of actions.
Intuitively, at each state a strategy determines a distribution over actions to take.
This decision may be based on the history of the current path.

  
  A strategy  for  is a function ^→()
  s. t. ((π)) ⊆(π) for all π∈^.
  ^ denotes the set of all strategies of .


A strategy  is memoryless if π=π' implies (π)=(π') for all π,π'∈(). 
It is deterministic if (π) is a Dirac distribution for all π∈().
A strategy that is not deterministic is randomized.
Here, we mostly use strategies that are memoryless and randomized, , of the form S→().

A strategy σ for an MDP resolves all nondeterministic choices, yielding an induced Markov chain (MC) , for which a probability measure over the set of infinite paths is defined by the standard cylinder set construction.

  
  Let MDP  and strategy ∈^. The MC induced by  and  is given by = (S,,,^) where:
  
    ^(s,s') = ∑_a ∈ A(s)(s)(a)  ·(s,a)(s') ∀ s,s'∈ S .






 §.§ Partial Observability









  
  A partially observable Markov decision process (POMDP) is a tuple  such that  is the underlying MDP of ,  is a finite set of observations and S→ is the observation function.


We require that states with the same observations have the same set of
enabled actions, , (s)=(s') implies (s)=(s') for all s,s'∈ S.
More general observation functions take the last action into account and provide a distribution over . There is a transformation of the general case to the POMDP definition used here that blows up the state space polynomially <cit.>. 

Furthermore, let (s|) be the probability that given observation ∈, the state of the POMDP is s∈ S. 
We assume a maximum-entropy probability distribution <cit.> to provide an initial distribution over potential states for an observation  given by
(s|) = 1/|{s' ∈ S |  = (s')}|.
Vice versa, we set (|s)=1 iff =(s) and (|s)=0 otherwise. 


The notion of paths directly transfers from MDPs to POMDPs.
We lift the observation function to paths: For a POMDP  and a path
π=s_0 s_1⋯ s_n∈^, the associated
observation sequence is (π)=(s_0)(s_1)⋯(s_n).
Note that several paths in the underlying MDP may yield the same observation sequence.
Strategies have to take this restricted observability into account.


  
  An observation-based strategy of POMDP  is a function 
  ^→() such
  that  is a strategy for the underlying MDP and for all paths π,π'∈^
  with (π)=(π') we have (π)=(π').
   ^ denotes the set of observation-based strategies for .


An observation-based strategy selects actions based on the observations encountered along a path and past actions.
Note that applying an observation-based strategy to a POMDP yields an induced MC as in Def. <ref>
where all nondeterminism and partial observability is resolved. 
Again, we use memoryless and randomized
strategies of the form →().

The semantics of a POMDP can be described using a belief MDP with an uncountable state space.
The idea is that each state of the belief MDP corresponds to a distribution over the states in the POMDP. 
This distribution is expected to correspond to the probability to be in a specific state based on the observations made so far. 






























 §.§ Specifications



For a POMDP , a set G⊆ S of goal states and a set
B⊆ S of bad states, we consider quantitative reach-avoid specifications
of the form φ=_⩾λ ( B  G).
A strategy ∈ satisfies this specifications if the probability of reaching a goal state without entering a bad state in between is at least λ in the induced MC, written ^φ.
We also use similar specifications of the form _≤κ ( B  G), measuring the expected cost to safely reach a goal state.

For POMDPs, observation-based strategies in their full generality are necessary <cit.>.

Consider a specification φ that is not satisfied by an MC or MDP .
One common definition of a counterexample is a (minimal) subset S'⊆ S
of the state space such that the MC or sub-MDP induced by S' still violates φ <cit.>.
The intuition is, that by the reduced state space critical parts are highlighted.



§ METHODOLOGY





 §.§ Problem Statement

We are given a partially observable planning scenario, which is modeled by a POMDP , and a specification φ.
The POMDP  is one of a family of similar planning scenarios, where each concrete scenario can modeled by an individual POMDP. 
The goal is to compute an observation-based randomized memoryless strategy ∈^ such that ^φ.

The general workflow we employ is shown in Fig. <ref>.
Note that we mostly assume a family of POMDP scenarios to train the human strategy, as will be explained in what follows.
We now detail the specific parts of the proposed approach.





 §.§ Training Environment


Our setting necessitates that a virtual and interactive environment called training environment sufficiently captures the  underlying POMDP planning scenarios.
The initial training environment can be parameterized for: the size of the environment; the numbers and locations of dynamic obstacles and landmarks; and the location of the goal state.

Similar classes of problems would require similar initial training environments. 
For example, an environment may incorporate a small grid with one dynamic obstacle and two landmarks, while the actual POMDP we are interested in needs the same number of dynamic obstacles but may induce a larger grid or add additional landmarks.
The goal state location also impacts the type of strategy trained by the human.
With a randomized goal location, the human will prioritize obstacle avoidance over minimizing expected cost.

We directly let the human control the agent towards a conveyable goal, such as avoiding obstacles while moving to the goal area.
We store all data regarding the human control inputs in a training set.
For a POMDP, this means that at each visited state of the underlying MDP we store the corresponding observation and the human's action choice.
We now collect data from several (randomly-generated) environments until statistically the human input will not significantly change the strategy by collecting further data.
In fact, the training set contains likelihoods of actions.




 §.§ Strategy Generation from Behavior Cloning

We  compute an environment-independent strategy for the agent by casting the collected data into probability distributions over actions for each observation at each state of the system.
Intuitively, the strategy is independent from a concrete environment but compatible with all concrete scenarios the training environment captures.
Generally, linear <cit.> or softmax regression <cit.> offers a means to interpret the likelihoods over actions into probabilities.
Formally, we get an observation-based strategy of the POMDP.
The computed strategy mimics typical human choices in all possible situations.

So far, such a strategy requires a large training set that needs a long time to be established, as we need human input for all different observations and actions.
If we do not have a sufficiently large training set, that is, we have a lack of data, the strategy is underspecified. 




We use data augmentation <cit.> to reduce the observation-action space upon which we train the strategy.
Our assumption is that the human acts similarly upon similar observations of the environment.
For instance, take two different observations describing that a moving obstacle is to the right border or to the left of the agent's range of vision.
While these are in fact different observations, they may trigger similar actions (moving into opposite directions – see Fig. <ref>) where on the left we see the possible observations for the agent and on the right two observations triggering similar actions (away from the obstacle).
Therefore, we define an equivalence relation on observations and actions.
We then weigh the likelihoods of equivalent actions for each state with equivalent observations and again cast these weighted likelihoods into probability distributions. 
Summarized, as this method reduces the observation-action space, it also reduces the required size of the training set and  the required number of human inputs.



 §.§ Refinement through Model Checking and Counterexamples
 
We apply the computed strategy to a POMDP for a concrete scenario.
As we resolve all nondeterminism and partial observability, the resulting model is an MC.
To efficiently verify this MC against the given specification, we employ probabilistic model checking using .
For instance, if for this MC the probability of reaching the goal area without bumping into obstacles is above a certain threshold, the computed strategy provably induces this exact probability.

In case PMC reveals that the obtained strategy does not satisfy the requirements, we need to improve the strategy for the specific POMDP we are dealing with. 
Here, we again take advantage of the human-in-the-loop principle.
First, we generate a counterexample using, , the techniques described in <cit.>. 
Such a counterexample highlights critical parts of the state space of the induced MC. 
We then immerse the human into critical parts in the virtual environment corresponding to critical states of the specific POMDP.
By gathering more data in these apparently critical situations for this scenario we strive to improve the human performance and the quality of the strategy.



§ RANDOMIZED STRATEGIES



Deciding if there is an observation-based strategy for a POMDP satisfying a specification as in Sec. <ref> typically requires unbounded memory and
is undecidable in general <cit.>

If we restrict ourselves to the class of memoryless strategies (which
decide only depending on the current observation), we need to distinguish
two sub-classes: (1) finding an optimal deterministic memoryless strategy is
NP-complete <cit.>, (2) finding an optimal randomized memoryless
strategy NP-hard, SQRT-SUM-hard, and in PSPACE <cit.>. From a
practical perspective, randomized strategies are much more powerful as one
can – to a certain extent – simulate memory by randomization.
The following example illustrates this effect and its limitations.





  In the POMDP in Fig. <ref>, observations
  are defined by colors. The goal is to reach s_7
  with maximal probability. The only states with nondeterminism are
s_3, s_4, and s_5 (blue).
  For a memoryless deterministic strategy selecting “up” in all blue states, the optimal value is 23.

  A memoryless randomized strategy can select “up” with probability
  0<p<1 and “down” with probability 1-p for blue states. Then both
  from s_3 and s_4, the target states are eventually reached with probability 1
  and from s_5 with probability p. Therefore the probability to reach
  s_7 from the initial state is 23 + 13p < 1.

  Finally, deterministic strategies with memory can distinguish
  state s_5 from s_3 and s_4 because their predecessors have different
  observations. 
  An optimal strategy may select “up” in a blue
  state if its predecessor is yellow, and otherwise “up” if a blue
  state has been seen an even number of times and “down” for an odd number, yielding probability 1 to reach s_7.


Summarized, computing randomized memoryless strategies for POMDPs is – while still a hard problem – a powerful alternative to the harder or even undecidable problem of computing strategies with potentially infinite memory.






§ STRATEGY GENERATION



We detail the four phases to behavior cloning from human inputs:
(1) building a training set,
(2) feature-based data augmentation,
(3) the initial strategy generation, and
(4) refining the initial strategy using counterexamples.



 §.§ Training Set



We first provide a series of randomly-generated sample environments to build a human-based training set.
The environments are randomized in size, location and number of obstacles as well as the location of initial and goal states.
The training set  is represented as a function ×→, where (,)=n_a means that n_a is the number of times action  is selected by the human for observation .
The size of the training set is given by ||=∑_∈,∈(,).

In each sample environment, the human is given a map of the static environment – the locations of static obstacles and goal states – as well as an observation in the current state.
This observation may, for instance, refer to the position of a visible obstacle.
Moreover, the human is provided with one or more specifications.
Proscribing a threshold on the probability of reaching the goal to a human seems unpractical. 
Instead, to have the human act according to the specifications outlined in Sect. <ref>, we can for instance ask the human to maximize the probability of reaching the goal whilst minimizing an expected cost. 
In practice, this just means that the human attempts to maximize the probability of reaching the goal without crashing and as quickly as possible.
The human observes the obstacles one-step from the agent (see Fig. <ref>), but is not aware of the agent's precise position or if observed obstacles are static or dynamic. For an unknown initial position, there are two phases <cit.>:


  * Exploration: The human will first try to determine their position while taking advantage of knowledge of the static environment.

  * Exploitation: When the human is confident about their current position they will start moving towards the goal.

The human acts on each (randomly generated) concrete scenario until they either reach the goal or crash. We continue collecting data until the human's inputs no longer significantly change the  strategy.
The statistically-derived minimum required size || of the initial training set is bound by Hoeffding's inequality <cit.>.
In particular, we derive an upper bound ϵ∈ (with a confidence of 1-δ for δ∈ [0,1]) for the difference between (1) a strategy that is independent from further training with other concrete environments and (2) the strategy derived from the training set of size ||.

The number of samples is bounded by 

    || ≥1/2ϵ^2(ln2/δ) .








 §.§ Feature Representation










Human input – choices of observation-action pairs – for our simulations has limitations.
First, it may not cover the entire observation-space so we may have observations without (sufficient) human choices of actions; the resulting strategy will be underspecified.
Additionally, many of the observation-action pairs are equivalent in nature since – in our example setting – the tendency for the human's action input is to move away from neighboring obstacles.
Similar equivalences may be specified depending on the case study at hand.
We introduce a feature-based representation to take advantage of such similarities to reduce the required size of a training set. 




Consider therefore the gridworld scenario in Fig. <ref>.
Recall that the agent has restricted range of vision, see Fig. <ref>. 

The set of positions in the grid  ×⊆× is 

    = {(x, y) | x ∈{0,…,}, y ∈{0,…, }} .

For one dynamic obstacle, an agent state consists of the position (x_a,y_a)∈ of agent a and the position (x_o,y_o)∈ of the dynamic obstacle o, , s=(x_a,y_a,x_o,y_o)∈×.
The agent's actions = {(-1,0),(1,0),(0,1),(0,-1)} describe the one-step directions “left”, “right”, “up”, “down”.  
The set B of obstacle positions is B = { (x_o,y_o), (x_l_1,y_l_1),…,(x_l_m,y_l_m)| (x_o,y_o)∈,(x_l_i,y_l_i)∈,1≤ i≤ m} for  dynamic obstacle o and landmarks l_1,…,l_m.

The observations describe the relative position of obstacles with respect to the agent's position, see Fig. <ref>.
We describe these positions by a set of Boolean functions _i S× 2^Pos→{0,1} where S= _x ×_y is the agent's position and for a visibility distance of 1, _i is defined for  1≤ i≤ 8 by:

    _1(s,B) = 1  iff    ( (x_a-1,y_a-1) ∈ B )  (x_a=0)  (y_a=0), 
    _2(s,B) = 1  iff    ( (x_a-1,y_a)   ∈ B )  (x_a=0), 
    _3(s,B) = 1  iff    ( (x_a-1,y_a+1) ∈ B )  (x_a=0)  (y_a = n), 
    _4(s,B) = 1  iff    ( (x_a,y_a+1)   ∈ B )  (y_a=n), 
    _5(s,B) = 1  iff    ( (x_a+1,y_a+1) ∈ B )  (x_a=n)  (y_a=n), 
    _6(s,B) = 1  iff    ( (x_a+1,y_a)   ∈ B )  (x_a=n), 
    _7(s,B) = 1  iff    ( (x_a+1,y_a-1) ∈ B )  (x_a=n)  (y_a=0), 
    _8(s,B) = 1  iff    ( (x_a,y_a-1)   ∈ B )  (y_a=0) .

Note that for a visibility distance of 2, _i is defined for 1 ≤ i ≤ 24.

Consequently, an observation = (s) at state s is a  vector = (^(1),…,^(8))∈{0, 1 }^8 with
^(i)  = _i(s,B). The observation space ={_1,…, _256} is the set of all observation vectors.

Providing a human with enough environments to cover the entire observation space is inefficient. <cit.>
To simplify this space, we introduce action-based features <cit.>, which capture the short-term human behavior of prioritizing to avoid obstacles for  current observations.
Particularly, we define features f×→. In our example setting we have

    f_1(,)    = ∑^8_i=1^(i) , 
    
    f_2(,)    = | _x - ∑^3_i=1^(i) + ∑^7_i=5^(i)| ,  
    
    f_3(,)    = | _y - ∑_i∈{1,7,8}^(i) + ∑^5_i=3^(i)| ,

where f_1 describes the number of obstacles in the observations. f_2 and f_3 are the respective  x and y directional components of the difference between the motion of the agent's action (_x and _y respectively) and position of the obstacles in its observation. Then, the comprised feature function is f×→^3 with f(,)=(f_1(,),f_2(,),f_3(,)).


We define a component-wise “equivalence” of observations-action features:

    f(_1,_1) = f(_2,_2)⋀_i (f_i(_1,_1) = f_i(_2,_2)) .

In Fig. <ref>, both observations see an obstacle in the corner of the observable space. For the left-hand case, the obstacle is on the bottom-left and action “right” is taken to avoid it. In the right-hand case, the obstacle is on the top-right and action “left” is taken to avoid it. These observation-action cases are considered equivalent in our feature model.


  
  
  
  






In developing a strategy for the POMDP, we iterate through the observation-action space × and find feature-equivalent inputs based on the above criteria.   
A set of feature-equivalent inputs is then F̂ = { (_1,_1),…,(_k,_k)} where f(_1,_1)=f(_k,_k).
By using the feature-equivalent inputs we are guaranteed to require less human inputs.
The maximum possible size of the equivalent-feature set is |F̂| ≤84 =70, due to the number of permutations of f_1. So at best our feature method can allow for 70 times fewer inputs. 
The efficiency gained by the introduction of features is at least |F̂| ≥ 1+4/n for an empty n sized gridworld, the worst possible case.
The majority of observations in sparse gridworlds are zero- or single-obstacle observations with an average efficiency of approximately 𝔼[|F̂|] ∈ [80=1,81=8], which gives us a conservative lower bound on the efficiency from a feature-based representation.



 §.§ Initial Strategy Generation

The human training set  has been generated from a series of similar but randomly-generated environments. 
Therefore the initial strategy generated from the training set is independent from the particular environment that we synthesize a strategy for. 
For all (,) ∈× we assign the probability of selecting an action (,) from its corresponding feature's f(,) frequency in the training set compared to the set of all features with observation :






    (,) 
        = ∑_(_j,_j)∈F̂( (_j,_j)/∑__i ∈ (_j,_i)) .




For the cases where a sequence has no equivalence, we evenly distribute the strategy between the action choices  (such occasions are rare and our refinement procedure will improve any negative actions after model checking).

    (,) :=  1/||  if∑__i∈()(,_i) = 0 .




For the strategy , we perform model checking on the induced MC ^ to determine if the specification is satisfied.



 §.§ Refinement Using Counterexamples
 
When the specification is refuted, we compute a counterexample in form of a set of critical states S'⊆ S.
Note the probability of satisfying the specification will be comparatively low at these states.

 
 The human is then requested to update the strategy for the observations = (s) for all s∈ S'.
 
  For an observation  with an action update selection of _i, the observation-action strategy update parameter ^E(,) is:

    ^E(,) = 
    1/∑_s∈ S(s|) _reach(s)   if  a=a_i , 
          1    otherwise .



  
  




We perform a Bayesian update with normalization constant c to calculate the stochastic strategy where c=∑_∈'(,)


    '(,) =  1/c^E(,) (,) .


Thereby, at each control loop the probability of the human input a_i in the strategy is increased. 





Bounds on Optimality. 
As discussed in Sect. <ref>, a randomized memoryless strategy for a POMDP may not induce optimal values in terms of reachability probabilities or expected cost. 
Moreover, in our setting, there is a limit on the human's capability – for instance if there are too many features to comprehend.
An optimal strategy for the underlying MDP of a POMDP provides bounds on optimal values for the POMDP.
These values are a measure on what is achievable, although admittedly this bound may be very coarse.
Such a bounding within a reinforcement learning context is discussed in <cit.>.













 



 

































































































§ IMPLEMENTATION AND EXPERIMENTS










We implemented the motion planning setting as in Fig. <ref> inside an interactive MATLAB environment. 
Grid size, initial state, number of obstacles, and goal location are variables.

We use  <cit.> to perform probabilistic model checking of the induced MC of the POMDP, see Sect. <ref>. 


We use the POMDP prototype <cit.> and a point-based value iteration (PBVI) solver <cit.> for comparison with other tools.
Note that there exists no available tool to compute optimal randomized memoryless strategies. 
All experiments were conducted on a 2.5 GHz machine with 4 GB of RAM. 



 §.§ Efficient Data Collection



A human user trains an initial “generic” strategy through a simulation of multiple randomly-generated environments, varying in size, number of obstacles and goal location. In order to more accurately reflect the partially observable nature of the problem, the human is only shown a map of the “known” features (landmarks and goal location) in the environment as well as the observation associated with the current state.

The goal is to obtain a strategy from the data that is independent of a change in the environments.
We gather inputs according to Sect. <ref> and Sect. <ref>.


For a bound of ϵ=0.05 with confidence of 1-δ=0.99, we require || = 1060 samples, see Eq. <ref>. 
Furthermore, the efficiency factor introduced by the feature equivalence depends on the generated scenarios, , the number of features. 


For our examples, we conservatively assume an efficiency factor of 4, so we require || = 265 samples.
If the specification is refuted, we compute a critical part S'⊆ S of the state space S, , a counterexample.
By starting the simulation in concrete scenarios at locations induced by S', we “ask” the human for specific inputs that refine the strategy at critical parts.




 §.§ Experiments






  
Strategy Refinement
In Table <ref> we show 5 iterations of counterexample-based strategy refinement for a 4×4 gridworld.
In each iteration, we measure the time to construct the MC and the time to model check. 
These running times are negligible for this small example, important however is the probability for safely reaching a target, namely  ( B  G).
One can see that for the initial, generic strategy this probability is rather low.
Having the simulation start in critical parts iteratively improves this probability up to nearly 0.8, at which point we find no measurable improvement.
For this example, the upper bound on the maximum probability derived from MDP model checking is 1. 

Figure <ref> shows a heatmap of this improving behavior where darker coloring means higher probability for safely reaching the goal.

















  
Fixed goal location
When we fix the goal-location parameter to the top-right of the grid, we can examine the strategy refinement's impact on the expected number of steps to the goal (see <ref>). 
The grid-size space was randomly sampled between n ∈ [4,11], we also compare the impact of fixing the grid-size for the training set.
There is clearly a benefit to restricting the samples from the training set to samples of similar problem styles. In a 4×4 gridworld, a fixed training set of similar sized environments outperforms the strategies generated by a varying set of environment sizes (see Table <ref>).






  
Comparison to Existing Tools and Solvers
We generated POMDP models for several grid sizes with one landmark and one dynamic obstacle. 


We list the number of model states and the solution times for  our human-in-the-loop synthesis method, -POMDP and  PBVI. From Table <ref> we can see that for the smaller problem sizes, the existing tools perform slightly better than our method. However, as the problem grows larger, both -POMDP and PBVI run out of memory and are clearly outperformed. The advantage of our memoryless approach is that the strategy itself is independent of the size of the state space and the problem scales with the size of the verification for the induced MC.





§ CONCLUSION AND FUTURE WORK


We introduced a formal approach to utilize humans' inputs for strategy synthesis in a specific POMDP motion planning setting, where strategies provably adhere to specifications.
Our experiments showed that with a simple prototype we could raise the state-of-the-art, especially in the combination with formal verification.
In the future, we will investigate how to infer decisions based on memory and how to employ human-understandable counterexamples <cit.>.





§ ACKNOWLEDGMENT

	This work has been partly funded by ONR N00014-15-IP-00052, NSF 1550212, and DARPA W911NF-16-1-0001.

plain


