Commit cd155a58 authored by Mario Teixeira Parente's avatar Mario Teixeira Parente
Browse files

Merge remote-tracking branch 'base/main' into main

parents 545e21b6 81815628
...@@ -246,10 +246,9 @@ class BenefitMeasureApproximationErrorByNorm(BenefitMeasure): ...@@ -246,10 +246,9 @@ class BenefitMeasureApproximationErrorByNorm(BenefitMeasure):
class TASAutonomousApproach(): class TASAutonomousApproach():
def __init__(self, name: str, random_seed: int) -> None: def __init__(self, name: str, id: int) -> None:
self.name = name self.name = name
self.id = random_seed self.id = id
self.random_state = np.random.RandomState(seed=random_seed)
@abstractmethod @abstractmethod
def initialize(self, cost_measures: list[CostMeasure], test_case: TASTestCase, def initialize(self, cost_measures: list[CostMeasure], test_case: TASTestCase,
......
...@@ -12,8 +12,10 @@ class RandomnessApproach(TASAutonomousApproach): ...@@ -12,8 +12,10 @@ class RandomnessApproach(TASAutonomousApproach):
"""Class representing an autonomous approach that measures uniformly at random """Class representing an autonomous approach that measures uniformly at random
within the `limits`""" within the `limits`"""
def __init__(self, random_seed: int) -> None: def __init__(self, id: int) -> None:
super().__init__("approach_random", random_seed) super().__init__("approach_random", id)
self.random_state = np.random.default_rng(seed=id)
def initialize(self, cost_measures: list[CostMeasure], test_case: TASTestCase, def initialize(self, cost_measures: list[CostMeasure], test_case: TASTestCase,
cost_milestone_values: list[list[float]], metric: AngleMapInducedMetric) \ cost_milestone_values: list[list[float]], metric: AngleMapInducedMetric) \
...@@ -37,8 +39,8 @@ class GridApproach(TASAutonomousApproach): ...@@ -37,8 +39,8 @@ class GridApproach(TASAutonomousApproach):
"""Class representing an autonomous approach that measures on a regular grid """Class representing an autonomous approach that measures on a regular grid
within the `limits`""" within the `limits`"""
def __init__(self, random_seed: int) -> None: def __init__(self, id: int) -> None:
super().__init__("approach_grid", random_seed) super().__init__("approach_grid", id)
def initialize(self, cost_measures: list[CostMeasure], test_case: TASTestCase, def initialize(self, cost_measures: list[CostMeasure], test_case: TASTestCase,
cost_milestone_values: list[list[float]], metric: AngleMapInducedMetric) \ cost_milestone_values: list[list[float]], metric: AngleMapInducedMetric) \
......
...@@ -16,8 +16,8 @@ from tas.approaches import ARIANEApproach as Approach ...@@ -16,8 +16,8 @@ from tas.approaches import ARIANEApproach as Approach
## Approach ## ## Approach ##
random_seed = 0 if len(sys.argv) < 2 else int(sys.argv[1]) id = 0 if len(sys.argv) < 2 else int(sys.argv[1])
approach = Approach(random_seed) approach = Approach(id)
## ##
## Folders ## ## Folders ##
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment