Loading tools/soar_utilities.py +51 −11 Original line number Diff line number Diff line Loading @@ -179,8 +179,29 @@ def define_system(iIncidence=[], coordinates = [], verbose=5, return process_graph def get_pareto_front(process_graph, plot_all=False, objective="linear", save_results=False, verbose=5): def get_pareto_front( process_graph, plot_all=False, objective="linear", n_criteria = 3, red_deficit=True, save_results=False, verbose=5 ): """ :param process_graph: Soar process graph object :param plot_all: make all mpl plots :param objective: objective for optimization. linear is mass only, bilinear is mass and concentration :param n_criteria: criteria for branch and bound. 1 = just nsensors (trivial) 2 = obs and nsensors 3 = red, obs, and nsensors :param red_deficit: Description False: include surplus redundancy True: Do not include surplus redundancy :param save_results: save obs, redundant results to a pickle file :param verbose: unused """ # Visualization setup if plot_all: matplotlib.use("Qt5Agg") Loading Loading @@ -212,14 +233,14 @@ def get_pareto_front(process_graph, plot_all=False, objective="linear", # we want to enumerate all hydraulic layouts strObjective = "FlowOnly" xExhaustive = True feval.RedundancyDeficit = False feval.RedundancyDeficit = red_deficit iSearchMethod = 0 case "bilinear": iObj = 2 # too many layouts for flow + component, just do pareto strObjective = "FlowAndComponent1" xExhaustive = False feval.RedundancyDeficit = False feval.RedundancyDeficit = red_deficit iSearchMethod = 1 pass case _: Loading @@ -227,7 +248,7 @@ def get_pareto_front(process_graph, plot_all=False, objective="linear", pass # ncriteria is if we are looking at red and obs, ncrit=2 is just obs, nCriteria 3 is all 3 nCriteria = 3 nCriteria = n_criteria strProblem = ( "Front_" + str(iSystemID) Loading Loading @@ -396,8 +417,27 @@ def get_pareto_front(process_graph, plot_all=False, objective="linear", return Solutions def get_one_result(process_graph, layout, objective="linear", verbose=5): def get_one_result( process_graph, layout, objective="linear", n_criteria = 3, red_deficit=True, verbose=5 ): """ :param process_graph: Soar process graph object :param objective: objective for optimization. linear is mass only, bilinear is mass and concentration :param n_criteria: criteria for branch and bound. 1 = just nsensors (trivial) 2 = obs and nsensors 3 = red, obs, and nsensors :param red_deficit: Description False: include surplus redundancy True: Do not include surplus redundancy :param save_results: save obs, redundant results to a pickle file :param verbose: unused """ iSystemID = 99 match objective: Loading @@ -406,20 +446,20 @@ def get_one_result(process_graph, layout, objective="linear", verbose=5): # we want to enumerate all hydraulic layouts strObjective = "FlowOnly" xExhaustive = True feval.RedundancyDeficit = False feval.RedundancyDeficit = red_deficit case "bilinear": iObj = 2 # too many layouts for flow + component, just do pareto strObjective = "FlowAndComponent1" xExhaustive = False feval.RedundancyDeficit = False feval.RedundancyDeficit = red_deficit pass case _: print("Unknown option") pass # ncriteria is if we are looking at red and obs, ncrit=2 is just obs nCriteria = 2 nCriteria = n_criteria strProblem = ( "Front_" + str(iSystemID) Loading Loading
tools/soar_utilities.py +51 −11 Original line number Diff line number Diff line Loading @@ -179,8 +179,29 @@ def define_system(iIncidence=[], coordinates = [], verbose=5, return process_graph def get_pareto_front(process_graph, plot_all=False, objective="linear", save_results=False, verbose=5): def get_pareto_front( process_graph, plot_all=False, objective="linear", n_criteria = 3, red_deficit=True, save_results=False, verbose=5 ): """ :param process_graph: Soar process graph object :param plot_all: make all mpl plots :param objective: objective for optimization. linear is mass only, bilinear is mass and concentration :param n_criteria: criteria for branch and bound. 1 = just nsensors (trivial) 2 = obs and nsensors 3 = red, obs, and nsensors :param red_deficit: Description False: include surplus redundancy True: Do not include surplus redundancy :param save_results: save obs, redundant results to a pickle file :param verbose: unused """ # Visualization setup if plot_all: matplotlib.use("Qt5Agg") Loading Loading @@ -212,14 +233,14 @@ def get_pareto_front(process_graph, plot_all=False, objective="linear", # we want to enumerate all hydraulic layouts strObjective = "FlowOnly" xExhaustive = True feval.RedundancyDeficit = False feval.RedundancyDeficit = red_deficit iSearchMethod = 0 case "bilinear": iObj = 2 # too many layouts for flow + component, just do pareto strObjective = "FlowAndComponent1" xExhaustive = False feval.RedundancyDeficit = False feval.RedundancyDeficit = red_deficit iSearchMethod = 1 pass case _: Loading @@ -227,7 +248,7 @@ def get_pareto_front(process_graph, plot_all=False, objective="linear", pass # ncriteria is if we are looking at red and obs, ncrit=2 is just obs, nCriteria 3 is all 3 nCriteria = 3 nCriteria = n_criteria strProblem = ( "Front_" + str(iSystemID) Loading Loading @@ -396,8 +417,27 @@ def get_pareto_front(process_graph, plot_all=False, objective="linear", return Solutions def get_one_result(process_graph, layout, objective="linear", verbose=5): def get_one_result( process_graph, layout, objective="linear", n_criteria = 3, red_deficit=True, verbose=5 ): """ :param process_graph: Soar process graph object :param objective: objective for optimization. linear is mass only, bilinear is mass and concentration :param n_criteria: criteria for branch and bound. 1 = just nsensors (trivial) 2 = obs and nsensors 3 = red, obs, and nsensors :param red_deficit: Description False: include surplus redundancy True: Do not include surplus redundancy :param save_results: save obs, redundant results to a pickle file :param verbose: unused """ iSystemID = 99 match objective: Loading @@ -406,20 +446,20 @@ def get_one_result(process_graph, layout, objective="linear", verbose=5): # we want to enumerate all hydraulic layouts strObjective = "FlowOnly" xExhaustive = True feval.RedundancyDeficit = False feval.RedundancyDeficit = red_deficit case "bilinear": iObj = 2 # too many layouts for flow + component, just do pareto strObjective = "FlowAndComponent1" xExhaustive = False feval.RedundancyDeficit = False feval.RedundancyDeficit = red_deficit pass case _: print("Unknown option") pass # ncriteria is if we are looking at red and obs, ncrit=2 is just obs nCriteria = 2 nCriteria = n_criteria strProblem = ( "Front_" + str(iSystemID) Loading