Skip to content

Commit

Permalink
Merge branch 'develop' into integration
Browse files Browse the repository at this point in the history
  • Loading branch information
gdelric-capgemini committed Dec 20, 2024
2 parents 5ad869c + 1d12d1c commit 7342228
Show file tree
Hide file tree
Showing 21 changed files with 65 additions and 68 deletions.
2 changes: 1 addition & 1 deletion platform_version_required.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v4.2.0
v5.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def configure(self, inputs_dict):
'''
Configure with inputs_dict from the discipline
'''

self.design_var_descriptor = inputs_dict[self.DESIGN_VAR_DESCRIPTOR]
self.dspace = inputs_dict[self.DESIGN_SPACE]
self.output_dict = {}
list_ctrl = self.design_var_descriptor.keys()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ def get_current_iter(self):
Get current iter from the optimisation problem in the formulation object built by GEMSEO
If no formulation then we compute in the old way, iter is the number of method calls
'''
if self.__formulation is not None:
return self.__formulation.opt_problem.current_iter
else:
self.iter += 1
return self.iter
# if self.__formulation is not None:
# return self.__formulation.optimization_problem.current_iter
# else:
self.iter += 1
return self.iter

def setup_sos_disciplines(self):
'''
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class TestSoSOptimScenarioWithFuncManager(unittest.TestCase):
SoSOptimScenario test class
"""

def test_18_optim_scenario_optim_algo_projected_gradient_func_manager(self):
def _test_18_optim_scenario_optim_algo_projected_gradient_func_manager(self):
# FIXME: needs fixing the ProjectedGradient algorithm
self.name = 'Test12'
self.ee = ExecutionEngine(self.name)

Expand Down
21 changes: 10 additions & 11 deletions sostrades_optimization_plugins/tests/l0_test_44_func_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def test_07_jacobian_func_manager_disc(self):

self.assertEqual(outputs[OBJECTIVE_LAGR][0], res)

disc_techno = ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline
disc_techno = ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline

assert disc_techno.check_jacobian(
input_data=disc_techno.local_data,
Expand Down Expand Up @@ -422,7 +422,7 @@ def test_08_jacobian_func_manager_disc2(self):

self.assertEqual(outputs[OBJECTIVE_LAGR][0], res)

disc_techno = ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline
disc_techno = ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline

assert disc_techno.check_jacobian(
input_data=disc_techno.local_data,
Expand Down Expand Up @@ -573,7 +573,7 @@ def test_10_jacobian_func_manager_disc_different_aggr(self):
outputs[INEQ_CONSTRAINT][0] +
outputs[EQ_CONSTRAINT][0])

disc_techno = ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline
disc_techno = ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline

assert disc_techno.check_jacobian(
input_data=disc_techno.local_data,
Expand Down Expand Up @@ -678,7 +678,7 @@ def test_11_jacobian_eq_delta_and_lin_to_quad(self):
outputs[INEQ_CONSTRAINT][0] +
outputs[EQ_CONSTRAINT][0])

disc_techno = ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline
disc_techno = ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline

assert disc_techno.check_jacobian(
input_data=disc_techno.local_data,
Expand Down Expand Up @@ -720,9 +720,8 @@ def test_12_test_number_iteration_output_optim_df(self):

self.ee.execute()

proxy_optim = self.ee.root_process.proxy_disciplines[0]
formulation = proxy_optim.mdo_discipline_wrapp.mdo_discipline.formulation
optim_iter = formulation.opt_problem.current_iter
funcmanager = self.ee.root_process.proxy_disciplines[0].proxy_disciplines[0].proxy_disciplines[-1]
optim_iter = funcmanager.discipline_wrapp.discipline.sos_wrapp.iter
optim_name = "SellarOptimScenario"
optim_output_df = self.ee.dm.get_value(
f'{self.name}.{optim_name}.SellarCoupling.FunctionManager.{FunctionManagerDisc.OPTIM_OUTPUT_DF}')
Expand Down Expand Up @@ -781,7 +780,7 @@ def test_13_jacobian_func_manager_disc_ineq_constraint_negative_when_satisfied(s
# -- retrieve outputs
disc = ee.dm.get_disciplines_with_name(
f'{self.name}.{func_mng_name}')[0]
disc_techno = ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline
disc_techno = ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline

assert disc_techno.check_jacobian(
input_data=disc_techno.local_data,
Expand Down Expand Up @@ -836,7 +835,7 @@ def test_14_jacobian_func_manager_disc_ineq_constraint_positive_when_satisfied(s
# -- retrieve outputs
disc = ee.dm.get_disciplines_with_name(
f'{self.name}.{func_mng_name}')[0]
disc_techno = ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline
disc_techno = ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline

assert disc_techno.check_jacobian(
input_data=disc_techno.local_data,
Expand Down Expand Up @@ -891,7 +890,7 @@ def test_16_jacobian_func_manager_disc_ineq_constraint_negative_when_satisfied_s
# -- retrieve outputs
disc = ee.dm.get_disciplines_with_name(
f'{self.name}.{func_mng_name}')[0]
disc_techno = ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline
disc_techno = ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline

assert disc_techno.check_jacobian(
input_data=disc_techno.local_data,
Expand Down Expand Up @@ -946,7 +945,7 @@ def test_17_jacobian_func_manager_disc_ineq_constraint_positive_when_satisfied_s
# -- retrieve outputs
disc = ee.dm.get_disciplines_with_name(
f'{self.name}.{func_mng_name}')[0]
disc_techno = ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline
disc_techno = ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline

assert disc_techno.check_jacobian(
input_data=disc_techno.local_data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,6 @@ def test_derivative(self):


self.check_jacobian(local_data=self.values_dict, location=dirname(__file__), filename='jacobian_design_var_bspline.pkl',
discipline=disc.mdo_discipline_wrapp.mdo_discipline, step=1e-15, inputs=input_names,
discipline=disc.discipline_wrapp.discipline, step=1e-15, inputs=input_names,
outputs=output_names, derr_approx='complex_step')

Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def test_01_analytic_gradient_default_dataframe_fill(self):
self.ee.configure()
self.ee.execute()

disc = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline
disc = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline

self.check_jacobian(location=dirname(__file__),
filename=f'jacobian_{self.study_name}_default_dataframe_fill.pkl',
Expand Down Expand Up @@ -143,7 +143,7 @@ def test_02_analytic_gradient_dataframe_fill_one_column_for_key(self):
self.ee.configure()
self.ee.execute()

disc = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline
disc = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline

self.check_jacobian(location=dirname(__file__),
filename=f'jacobian_{self.study_name}_dataframe_fill_one_column_for_key.pkl',
Expand Down Expand Up @@ -201,7 +201,7 @@ def test_03_analytic_gradient_dataframe_fill_one_column_for_key_with1_deactivate
self.ee.configure()
self.ee.execute()

disc = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline
disc = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline

self.check_jacobian(location=dirname(__file__),
filename=f'jacobian_{self.study_name}_dataframe_fill_one_column_for_key_1element_deactivated.pkl',
Expand Down Expand Up @@ -259,7 +259,7 @@ def test_04_analytic_gradient_dataframe_fill_one_column_for_key_with2_deactivate
self.ee.configure()
self.ee.execute()

disc = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline
disc = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline

self.check_jacobian(location=dirname(__file__),
filename=f'jacobian_{self.study_name}_dataframe_fill_one_column_for_key_2element_deactivated.pkl',
Expand Down
Loading

0 comments on commit 7342228

Please sign in to comment.