Ejemplo n.º 1
0
def ultimate():
    dot.dotpr = "neato"
    m = core.ConsMDP()
    m.new_states(11)
    for r in [2, 4, 9]:
        m.set_reload(r)
    T = {7, 8, 10}

    m.add_action(0, {1: .5, 2: .5}, "a", 1)
    m.add_action(0, {3: .5, 4: .5}, "t", 3)
    m.add_action(1, {2: 1}, "", 1)
    m.add_action(2, {1: 1}, "", 1)

    m.add_action(3, {2: .5, 7: .5}, "p", 1)
    m.add_action(3, {5: 1}, "r", 2)
    m.add_action(3, {6: 1}, "a", 3)

    m.add_action(4, {5: 1}, "", 1)
    m.add_action(5, {4: 1}, "r", 1)
    m.add_action(5, {3: 1}, "t", 1)

    m.add_action(6, {7: .5, 10: .5}, "a", 3)
    m.add_action(6, {3: .5, 8: .5}, "B", 6)

    m.add_action(7, {9: 1}, "", 1)
    m.add_action(9, {9: 1}, "", 1)
    m.add_action(10, {9: 1}, "", 1)

    m.add_action(8, {5: 1}, "r", 3)

    return m, T
Ejemplo n.º 2
0
def little_alsure():
    dot.dotpr = "dot"
    m = core.ConsMDP()
    m.new_states(4)
    for r in [3]:
        m.set_reload(r)
    m.add_action(0, {1: .5, 2: .5}, "t", 2)
    m.add_action(1, {3: 1}, "r", 1)
    m.add_action(2, {3: 1}, "r", 2)
    m.add_action(3, {3: 1}, "r", 3)
    m.add_action(0, {1: .5, 3: .5}, "pos", 1)

    targets = set([1, 2])
    return m, targets
Ejemplo n.º 3
0
def basic():
    dot.dotpr = "neato"
    m = core.ConsMDP()

    m.new_states(9)
    for s in [0, 7]:
        m.set_reload(s)

    m.add_action(0, {1: 1}, "", 1)
    m.add_action(1, {0: 1}, "", 1)
    m.add_action(2, {1: 1}, "", 1)
    m.add_action(3, {2: .5, 1: .5}, "", 1)
    m.add_action(3, {4: .5, 6: .5}, "t", 10)
    m.add_action(4, {5: 1}, "t", 1)
    m.add_action(5, {6: 1}, "r", 1)
    m.add_action(6, {3: .5, 7: .5}, "t", 6)
    m.add_action(6, {7: 1}, "r", 1)
    m.add_action(7, {3: 1}, "", 20)
    m.add_action(7, {6: 1}, "t", 3)
    m.add_action(8, {7: .5, 2: .5}, "", 5)

    targets = set([2, 5])

    return m, targets
Ejemplo n.º 4
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from fimdp import core
from math import inf
from fimdp.energy_solvers import BasicES, LeastFixpointES
from fimdp.objectives import MIN_INIT_CONS, SAFE
from sys import stderr

# ## Simple example

m = core.ConsMDP()
m.new_states(13)
for sid in [0,3,4,9,11]:
    m.set_reload(sid)

# +
m.add_action(1, {0:.5, 2: .25, 12: .25}, "a", 1)
m.add_action(2, {4:1}, "a", 2)
m.add_action(12, {3:1}, "a", 1)
m.add_action(3, {3:.5, 4: .5}, "a", 1)
m.add_action(4, {1:1}, "a", 0)
m.add_action(7, {3:1}, "a", 1)
m.add_action(7, {6:1}, "b", 1)
m.add_action(6, {4:.5, 5:.5}, "a", 5)
m.add_action(5, {1:1}, "a", 6)
m.add_action(8, {9:1}, "a", 1)
m.add_action(8, {1:1}, "b", 3)
m.add_action(10, {1:.5, 11:.5}, "a", 2)
m.add_action(0, {0:1}, "r", 0)
m.add_action(9, {9:1}, "r", 0)
m.add_action(11, {11:1}, "a", 1)