File tree Expand file tree Collapse file tree 3 files changed +17
-10
lines changed
Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -5,9 +5,9 @@ name: Basic Tests
55
66on :
77 push :
8- branches : [ "main" ]
8+ branches : [ "main", "dev" ]
99 pull_request :
10- branches : [ "main" ]
10+ branches : [ "main", "dev" ]
1111
1212jobs :
1313 test :
Original file line number Diff line number Diff line change @@ -75,9 +75,16 @@ def _get_n_valid_discrete(self) -> int:
7575
7676 def _is_conditionally_active (self ) -> List [bool ]:
7777 _ , is_act_all = self .all_discrete_x
78- if is_act_all is None :
79- raise RuntimeError (f'_is_conditionally_active not implemented for { self .__class__ .__name__ } ' )
80- return list (np .any (~ is_act_all , axis = 0 ))
78+ if is_act_all is not None :
79+ return list (np .any (~ is_act_all , axis = 0 ))
80+
81+ if isinstance (self ._problem , MultiAssignmentProblem ):
82+ dv_cond = []
83+ for assignment_manager in self ._problem .assignment_managers :
84+ dv_cond += [dv .conditionally_active for dv in assignment_manager .design_vars ]
85+ return dv_cond
86+
87+ return [dv .conditionally_active for dv in self ._problem .assignment_manager .design_vars ]
8188
8289 def _gen_all_discrete_x (self ) -> Optional [Tuple [np .ndarray , np .ndarray ]]:
8390 if isinstance (self ._problem , AnalyticalProblemBase ):
Original file line number Diff line number Diff line change @@ -29,13 +29,17 @@ def test_partitioning():
2929 Partitioning ().print_stats ()
3030 run_test_hierarchy (PartitioningCovering (), 1.71 )
3131
32+ _ = PartitioningCovering ().is_conditionally_active
33+
3234
3335@check_dependency ()
3436def test_unordered ():
3537 run_test_hierarchy (UnordNonReplComb (), 2.55 )
3638 UnordNonReplCombLarge ().print_stats ()
3739 UnorderedComb ().print_stats ()
3840
41+ _ = UnorderedComb ().is_conditionally_active
42+
3943
4044@check_dependency ()
4145def test_assign_enc_gnc ():
@@ -49,8 +53,4 @@ def test_assign_enc_gnc():
4953 assert problem .get_n_valid_discrete () == n_valid
5054
5155 x_all , _ = problem .all_discrete_x
52- if x_all is not None :
53- _ = problem .is_conditionally_active
54- else :
55- with pytest .raises (RuntimeError ):
56- _ = problem .is_conditionally_active
56+ _ = problem .is_conditionally_active
You can’t perform that action at this time.
0 commit comments