Commit eb8a33b4 authored by Blais, Chris's avatar Blais, Chris
Browse files

remove 'add_graph_info' calls. redundant and regenerates cutsets (time intensive)

parent 8906e8eb
Loading
Loading
Loading
Loading
+1 −30
Original line number Diff line number Diff line
@@ -238,21 +238,12 @@ def get_pareto_front(process_graph, plot_all=False, objective="linear",
    )
    print(strProblem)

    tElapsedOuter = np.ones(5) * np.nan

    tStartOuter = time.perf_counter()
    tElapsedOuter[0] = time.perf_counter() - tStartOuter

    if plot_all:
        fig = plot_graph(process_graph)
        fig.canvas.draw()
        fig.canvas.flush_events()
        plt.show(block=False)

    process_graph.add_graph_info(verbose)
    tElapsedOuter[1] = time.perf_counter() - tStartOuter
    # iNumberOfArc = process_graph.iNumberOfArc

    match strObjective:
        case "FlowOnly":
            process_graph.xSensorCandidate[:, :-1] = 0
@@ -290,9 +281,6 @@ def get_pareto_front(process_graph, plot_all=False, objective="linear",
    # nLayout = 2
    iLayoutBnd = [0, nLayout]

    # ====================================
    tElapsedOuter[2] = time.perf_counter() - tStartOuter

    feval.lapse = np.ones([nLayout, nCriteria]) * np.nan

    xMeasured_default = process_graph.xMeasured.copy()
@@ -321,8 +309,6 @@ def get_pareto_front(process_graph, plot_all=False, objective="linear",
        )
        Solutions = np.where(xLayoutOnFront)[0]
        iObjectives = feval.criteria[Solutions, :]

        tElapsedOuter[3] = time.perf_counter() - tStartOuter
        pass

    else:
@@ -345,7 +331,6 @@ def get_pareto_front(process_graph, plot_all=False, objective="linear",
            strProblem,
        )
        
        tElapsedOuter[3] = time.perf_counter() - tStartOuter
        iObjectives = iTree[:, 2 + np.arange(nCriteria)]
        iObjectives[:, 1] = -iObjectives[:, 1]
        if nCriteria >= 3:
@@ -445,17 +430,6 @@ def get_one_result(process_graph, layout, objective="linear", verbose=5):
    )
    print(strProblem)

    tElapsedOuter = np.ones(5) * np.nan

    tStartOuter = time.perf_counter()
    tElapsedOuter[0] = time.perf_counter() - tStartOuter

    # this is where cutset enumeration happens
    process_graph.add_graph_info(verbose)
    
    tElapsedOuter[1] = time.perf_counter() - tStartOuter
    # iNumberOfArc = process_graph.iNumberOfArc

    match strObjective:
        case "FlowOnly":
            process_graph.xSensorCandidate[:, :-1] = 0
@@ -492,9 +466,6 @@ def get_one_result(process_graph, layout, objective="linear", verbose=5):

    iLayoutBnd = [0, nLayout]

    # ====================================
    tElapsedOuter[2] = time.perf_counter() - tStartOuter

    feval.lapse = np.ones([nLayout, nCriteria]) * np.nan

    xMeasured_default = process_graph.xMeasured.copy()