mitl_task_solver_temporal_robustness is a Python library that computes strategies from Metric Interval Temporal Logic specifications, with an underlying Weighted Transition System or Markov Decision Process model of the environments, using Mixed Integer Linear Programming.
In environments like offices, the duration of a robot's navigation between two locations may vary over time. For instance, reaching a kitchen may take more time during lunchtime since the corridors are crowded with people heading the same way.
We address the problem of routing in such environments with tasks expressed in Metric Interval Temporal Logic (MITL), a rich robot task specification language that allows to capture explicit time requirements. We want to find a strategy/plan that maximizes the temporal robustness of the robot's MITL task.
As the first step towards a solution, we define a Linear Programming approach to solving the task planning problem over a Varying Weighted Transition System, where navigation durations are deterministic but vary depending on the time of day.
Then, we apply this planner to optimize for MITL temporal robustness in Markov Decision Processes, where the navigation durations between physical locations are uncertain, but the time-dependent distribution over possible delays is known. Finally, we develop a receding horizon planner for Markov Decision Processes that preserves guarantees over MITL temporal robustness.
You can use this API by cloning this repository:
$ git clone https://github.com/KTH-RPL-Planiacs/mitl_task_solver_temporal_robustness.git
Dependencies:
- Python 3
- Pulp
- Gurobi MILP Solver
The module MTL.py
implements the formalism of MTL Formulae.
It supports several boolean (Conjunction, Disjunction, Negation) and temporal operators (Until, Always, Eventually).
t = MTLFormula.TrueF()
f = MTLFormula.FalseF()
kitchen = MTLFormula.Predicate('K')
is an MITL Formula, where the constructor takes 1 arguments:
predicate
: the predicate's name (ex:'K'
), that has to match
c = MTLFormula.Conjunction(list_formulas)
d = MTLFormula.Disjunction(list_formulas)
are MITL Formulae respectively representing the Conjunction and Disjunction of several MITL Formulae in list_formulas
, where list_formulas
is a list of MITL Formulae.
n = MTLFormula.Negation(phi)
is an MITL Formula representing the negation of an MITL Formula phi
.
u = MTLFormula.Until(phi1,phi2,t1,t2)
a = MTLFormula.Always(phi,t1,t2)
e = MTLFormula.Eventually(phi,t1,t2)
are MITL Formulae respectively representing the Until, Always and Eventually temporal operators. They takes the following arguments:
phi1
: an MITL formulaphi2
: an MITL formula (for the Until operator only)t1
: lower time interval boundt2
: upper time interval bound
The module WTS.py
implements the formalism of a Weighted Transition System with dynamic weights. It takes the following arguments:
S
: the set of statess_0
: the initial stateT
: the transitionsAP
: the atomic predicatesL
: the labelling function, returning for each state, its set of labelsC
: the weight function. For instance,C[('s_5_1',50,'s_5_2')] = 3
means that it takes 3 time units to transit between's_5_1'
and's_5_2'
a timet=50
.
In a similar fashion, MDP_Object.py
and MDP_examples.py
implement the MDPs related function, among which timed MDPs (function construct_timed_MDP
) and history MDPs (function construct_history_MDP
) that include time and history of visited states, in the state space.
The function generate_plan_mtl_wts(Demands,wts,PLANNING_HORIZON)
returns a plan/strategy, and takes 3 arguments:
Demands
: a list of tuples, (mitl_formula
,priority
) assigning to each MITL demand a prioritywts
: the WTS abstraction of the environmentPLANNING_HORIZON
: the planning horizon (should be greater than the demands' horizon)
The MTLTaskAllocSolver_MDP2
class does so for the MDP model of the environment.
In a simulation of an office-like environment, we ran several experiments to show the scalability of our method:
See folder experiments_wts
and experiments_mdp
for details on the model, as well as the different MITL specifications.