Пример #1
0
import sys
# +------------------------------------------+
# |     construct transition system graph    |
# +------------------------------------------+

workspace, regions, obs, init_state, uni_cost, formula,  formula_comp, exclusion, no = problemFormulation().Formulation()
ts = {'workspace':workspace, 'region':regions, 'obs':obs, 'uni_cost':uni_cost}
# plot the workspace
# ax = plt.figure(1).gca()
# region_plot(regions, 'region', ax)
# region_plot(obs, 'obs', ax)
# +------------------------------------------+
# |            construct buchi graph         |
# +------------------------------------------+

buchi = buchi_graph(formula, formula_comp, exclusion)
buchi.formulaParser()
buchi.execLtl2ba()
buchi_graph = buchi.buchiGraph()
buchi_state = dict(zip(list(buchi_graph.nodes()), range(1, buchi_graph.number_of_nodes() + 1)))  # dict

# +------------------------------------------+
# |            construct prefix path         |
# +------------------------------------------+

n_max = 10000
n_robot = len(init_state)
step_size = 0.25*n_robot
cost_path = OrderedDict()

Пример #2
0

def FeasAcpt(buchi_graph, min_qb):
    """
    delte infeasible final state
    :param buchi_graph: buchi automaton
    :param min_qb: dict of pairs of node : length of path
    """
    accept = buchi_graph.graph['accept']
    for acpt in accept:
        if min_qb[(buchi_graph.graph['init'][0],
                   acpt)] == np.inf or min_qb[(acpt, acpt)] == np.inf:
            buchi_graph.graph['accept'].remove(acpt)


workspace, regions, obs, init_state, uni_cost, formula = problemFormulation(
).Formulation()
ts = {
    'workspace': workspace,
    'region': regions,
    'obs': obs,
    'uni_cost': uni_cost
}
buchi = buchi_graph(formula)
buchi.formulaParser()
buchi.execLtl2ba()
buchi_graph = buchi.buchiGraph()
DelInfesEdge(buchi_graph, len(init_state))
min_qb = MinLen(buchi_graph)
FeasAcpt(buchi_graph, min_qb)