Esempio n. 1
0
def log_plans(stream_plan, action_plan, iteration):
    # TODO: do this within the focused algorithm itself?
    decomposed_plan = decompose_stream_plan(stream_plan)
    with open(PLAN_LOG_FILE, 'a+') as f:
        f.write('Iteration: {}\n'
                'Stream plan: {}\n'
                'Synthesizer plan: {}\n'
                'Action plan: {}\n\n'.format(iteration, decomposed_plan,
                                             stream_plan,
                                             str_from_plan(action_plan)))
Esempio n. 2
0
def create_visualizations(evaluations, stream_plan, iteration):
    # TODO: place it in the temp_dir?
    # TODO: decompose any joint streams
    for result in stream_plan:
        if isinstance(result, SynthStreamResult):
            create_synthesizer_visualizations(result, iteration)
    filename = ITERATION_TEMPLATE.format(POST_PROCESS if iteration is None else iteration)
    # visualize_stream_plan(stream_plan, path)
    constraints = set() # TODO: approximates needed facts using produced ones
    for stream in stream_plan:
        constraints.update(filter(lambda f: evaluation_from_fact(f) not in evaluations, stream.get_certified()))
    visualize_constraints(constraints, os.path.join(CONSTRAINT_NETWORK_DIR, filename))
    visualize_stream_plan_bipartite(decompose_stream_plan(stream_plan), os.path.join(STREAM_PLAN_DIR, filename))
    visualize_stream_plan_bipartite(stream_plan, os.path.join(STREAM_PLAN_DIR, 'fused_' + filename))