Skip to content

Commit

Permalink
rename uid -> uid_of_individual
Browse files Browse the repository at this point in the history
  • Loading branch information
MorrisNein committed Oct 14, 2022
1 parent e9a4bd5 commit 671a464
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions fedot/core/optimisers/gp_comp/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def apply_evaluation_results(individuals: PopulationT,
evaluation_results: EvalResultsList) -> PopulationT:
"""Applies results of evaluation to the evaluated population.
Excludes individuals that weren't evaluated."""
evaluation_results = {res.uid: res for res in evaluation_results if res}
evaluation_results = {res.uid_of_individual: res for res in evaluation_results if res}
individuals_evaluated = []
for ind in individuals:
eval_res = evaluation_results.get(ind.uid)
Expand Down Expand Up @@ -128,7 +128,7 @@ def evaluate_population(self, individuals: PopulationT) -> Optional[PopulationT]
successful_evals = self.apply_evaluation_results([single_ind], [evaluation_result]) or None
return successful_evals

def evaluate_single(self, graph: OptGraph, uid: str, with_time_limit: bool = True, cache_key: Optional[str] = None,
def evaluate_single(self, graph: OptGraph, uid_of_individual: str, with_time_limit: bool = True, cache_key: Optional[str] = None,
logs_initializer: Optional[Tuple[int, pathlib.Path]] = None) -> OptionalEvalResult:

if with_time_limit and self.timer.is_time_limit_reached():
Expand All @@ -146,7 +146,7 @@ def evaluate_single(self, graph: OptGraph, uid: str, with_time_limit: bool = Tru
eval_time_iso = datetime.now().isoformat()

eval_res = GraphEvalResult(
uid=uid, fitness=fitness, graph=graph, metadata={
uid_of_individual=uid_of_individual, fitness=fitness, graph=graph, metadata={
'computation_time_in_seconds': end_time - start_time,
'evaluation_time_iso': eval_time_iso
}
Expand Down Expand Up @@ -204,7 +204,7 @@ def evaluate_population(self, individuals: PopulationT) -> Optional[PopulationT]
evaluated_population = individuals_evaluated + individuals_to_skip or None
return evaluated_population

def evaluate_single(self, graph: OptGraph, uid: str, with_time_limit=True) -> OptionalEvalResult:
def evaluate_single(self, graph: OptGraph, uid_of_individual: str, with_time_limit=True) -> OptionalEvalResult:
if with_time_limit and self.timer.is_time_limit_reached():
return None

Expand All @@ -216,7 +216,7 @@ def evaluate_single(self, graph: OptGraph, uid: str, with_time_limit=True) -> Op
eval_time_iso = datetime.now().isoformat()

eval_res = GraphEvalResult(
uid=uid, fitness=fitness, graph=graph, metadata={
uid_of_individual=uid_of_individual, fitness=fitness, graph=graph, metadata={
'computation_time_in_seconds': end_time - start_time,
'evaluation_time_iso': eval_time_iso
}
Expand Down
2 changes: 1 addition & 1 deletion fedot/core/optimisers/opt_history_objects/individual.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def __deepcopy__(self, memo):

@dataclass
class GraphEvalResult:
uid: str
uid_of_individual: str
fitness: Fitness
graph: OptGraph # For the case if evaluation needs to assign some values to the graph.
metadata: Dict[str, Any] = field(default_factory=dict)
Expand Down

0 comments on commit 671a464

Please # to comment.