File tree 2 files changed +7
-0
lines changed
2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -585,6 +585,11 @@ def abandoned_arms(self) -> list[Arm]:
585
585
"""All abandoned arms, associated with this trial."""
586
586
pass
587
587
588
+ @property
589
+ def active_arms (self ) -> list [Arm ]:
590
+ """All non abandoned arms associated with this trial."""
591
+ return [arm for arm in self .arms if arm not in self .abandoned_arms ]
592
+
588
593
@abstractproperty
589
594
def generator_runs (self ) -> list [GeneratorRun ]:
590
595
"""All generator runs associated with this trial."""
Original file line number Diff line number Diff line change @@ -413,6 +413,8 @@ def test_AbandonArm(self) -> None:
413
413
metadata = self .batch .abandoned_arms_metadata [0 ]
414
414
self .assertEqual (metadata .reason , reason )
415
415
self .assertEqual (metadata .name , arm .name )
416
+ self .assertEqual (len (self .batch .active_arms ), len (self .arms ) - 1 )
417
+ self .assertNotIn (arm , self .batch .active_arms )
416
418
417
419
# Fail to abandon arm not in BatchTrial
418
420
with self .assertRaises (ValueError ):
You can’t perform that action at this time.
0 commit comments