Real-world applications typically contain a mixture of continuous and discrete variables. We have extended MLNs to Hybrid Markov Logic Networks (HMLNs) to accomodate these type of domains. Here, we demonstrate this ability on a small robot mapping domain.
The goal is to infer the map of an indoor environment from laser range data, obtained by the robot as it moves about the environment. The evidence is a set of range finder segments, defined by the (x, y) coordinates of their endpoints. The output is: (a) a labeling of each segment as Door or Wall (classification), given by the predicate SegType(segment, type), and (b) an assignment of wall segments to the walls they are part of (clustering), given by the predicate PartOf(segment, wall).
First, we introduce a unit clause for the prior probability of each segment type:
Then, we introduce a typical length and depth of each type with:
SegType(s, Door) * (Length(s) = DoorLength) SegType(s, Door) * (Depth(s) = DoorDepth) SegType(s, Wall) * (Length(s) = WallLength) SegType(s, Wall) * (Depth(s) = WallDepth)
We also introduce the rule which states that aligned wall segments tend to be part of the same wall line:
SegType(s,Wall) ^ SegType(s',Wall) ^ Aligned(s,s') ^ PartOf(s,l) => PartOf(s',l)
There are many more rules which model the situation in greater depth, but for tutorial purposes, this model suffices to demonstrate how to model hybrid domains. The more complex model can be found on the Alchemy website.
We can learn weights for these formulas in one observed corridor by running:
learnwts -i robotmap.mln -robotmap-out.mln -t robotmap-train.db -noAddUnitClauses -ne SegType,PartOf
and we can run inference on a test corridor with:
infer -ms -hybrid -i robotmap-out.mln,test-constants.mln -r robotmap.results -e robotmap-test.db -q SegType,PartOf