Skip to content

Commit 0a72333

Browse files
committed
Fixed objectives/constraints not being validated properly immediately after opt settings load
1 parent f6d1bee commit 0a72333

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

pymead/gui/dialogs.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3587,6 +3587,12 @@ def __init__(self, parent, widgets: dict, settings_override: dict):
35873587
self.objectives = None
35883588
self.constraints = None
35893589

3590+
def setValue(self, new_inputs):
3591+
super().setValue(new_inputs)
3592+
# Make sure that the objectives and constraints get updated again after the multipoint/multi-geom tables
3593+
# are completely set up
3594+
self.w_dict["Genetic Algorithm"].update_objectives_and_constraints()
3595+
35903596

35913597
class OptimizationSetupDialog(PymeadDialog):
35923598
def __init__(self, parent, geo_col: GeometryCollection, theme: dict, grid: bool, settings_override: dict = None):

pymead/optimization/objectives_and_constraints.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def update_function(self):
8282
if not isinstance(return_val, float):
8383
raise FunctionCompileError(f"Error in function compilation output type. Required type is float,"
8484
f"found type {type(return_val)}")
85-
except (SyntaxError, NameError, TypeError):
85+
except (SyntaxError, NameError, TypeError, IndexError):
8686
raise FunctionCompileError('Error in function compilation')
8787

8888
def update_value(self):
@@ -95,7 +95,7 @@ def update_value(self):
9595
try:
9696
self.value = self.function_dict['f']() # no parameters passed as inputs (inputs all stored and updated
9797
# inside self.function_dict )
98-
except (SyntaxError, NameError, TypeError):
98+
except (SyntaxError, NameError, TypeError, IndexError):
9999
raise FunctionCompileError('Error in function update')
100100

101101
def update(self, dependencies: dict):

0 commit comments

Comments
 (0)