Skip to content

Commit

Permalink
Adding basic sequential runner
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewlee94 committed Nov 7, 2023
1 parent 9e80e17 commit 98a2503
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 389 deletions.
36 changes: 14 additions & 22 deletions idaes/core/util/parameter_sweep.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ def __init__(self, **kwargs):
def results(self):
return self._results

def execute_parameter_sweep(self):
raise NotImplementedError(
"Derived classes should overload this method with a " "workflow manager."
)

def execute_single_sample(self, sample_id):
model = self.get_initialized_model()

Expand Down Expand Up @@ -429,26 +434,13 @@ def from_json_file(self, filename):
f.close()


# class SequentialSweepRunner(ParameterSweepBase):
# def execute_parameter_sweep(self):
# self._results = {}
# ispec = self.get_input_specification()
#
# for s in ispec:
# sresults, solved = self.execute_single_sample(s)
# self._results[s] = {"solved": solved, "results": sresults}
#
# return self.results
class SequentialSweepRunner(ParameterSweepBase):
def execute_parameter_sweep(self):
self._results = OrderedDict()
samples = self.get_input_samples()

#
# def _verify_samples_from_dict(self, compare_dict):
# comp_samples = DataFrame().from_dict(
# compare_dict["specification"]["samples"],
# orient="tight",
# )
# try:
# assert_frame_equal(self.get_input_samples(), comp_samples)
# except AssertionError:
# raise ValueError(
# "Samples in comparison evaluation do not match current evaluation"
# )
for s in samples.index:
sresults, solved = self.execute_single_sample(s)
self._results[s] = {"solved": solved, "results": sresults}

return self.results
Loading

0 comments on commit 98a2503

Please sign in to comment.