Esempio n. 1
0
def  _multi_round_nmdp():
    with dsl.new() as mdp:
        start = dsl.state()
        end = dsl.terminal_state()

        start & dsl.action() > dsl.reward(5) | start | end * 2
        start & dsl.action() > dsl.reward(3) | start * 2 | end

        dsl.discount(0.5)

        ret = mdp.validate()
        t, r = ret.get_transition_and_reward_arrays()
        return ret
Esempio n. 2
0
def _one_round_nmdp():
    with dsl.new() as mdp:
        start = dsl.state()
        end = dsl.terminal_state()

        action_0 = dsl.action()
        action_1 = dsl.action()

        start & action_0 > dsl.reward(0) | dsl.reward(5)
        start & action_1 > dsl.reward(1) | dsl.reward(3)

        start & (action_0 | action_1) > end

        return mdp.validate()
Esempio n. 3
0
def _two_round_dmdp():
    with dsl.new() as mdp:
        start = dsl.state()
        better = dsl.state()
        worse = dsl.state()
        end = dsl.terminal_state()

        action_0 = dsl.action()
        action_1 = dsl.action()

        start & action_0 > better
        better & action_1 > dsl.reward(3)

        start & action_1 > worse
        worse & action_0 > dsl.reward(1)
        worse & action_1 > dsl.reward(2)

        (better | worse) & (action_0 | action_1) > end

        return mdp.validate()
Esempio n. 4
0
def _two_round_nmdp():
    with dsl.new() as mdp:
        start = dsl.state()
        a = dsl.state()
        b = dsl.state()
        end = dsl.terminal_state()

        action_0 = dsl.action()
        action_1 = dsl.action()

        start & action_0 > a
        a & action_0 > dsl.reward(-1) | dsl.reward(1)
        a & action_1 > dsl.reward(0) * 2 | dsl.reward(9)

        start & action_1 > b
        b & action_0 > dsl.reward(0) | dsl.reward(2)
        b & action_1 > dsl.reward(2) | dsl.reward(3)

        (a | b) & (action_0 | action_1) > end

        return mdp.validate()