diff --git a/sxpat/synthesis.py b/sxpat/synthesis.py index a9cc71f98..11b50045f 100644 --- a/sxpat/synthesis.py +++ b/sxpat/synthesis.py @@ -170,9 +170,25 @@ def get_num_models_from_json(self, json_obj: List[Dict]): def set_path(self, this_path: Tuple[str, str], this_name: Optional[str] = None, id: int = 0): if this_name is None: + # get data from name data = NameData.from_filename(self.benchmark_name) + + # updte root if origin if data.is_origin: - data.root = f'{data.root}_{self.template_name}_enc{self.specs.encoding.value}' + data.root = '_'.join(( + data.root, + self.template_name, + f'et{self.specs.et}', + f'enc{self.specs.encoding.value}', + f'imax{self.specs.imax}', + f'omax{self.specs.omax}', + )) + + # update et + ET_PATTERN = re.compile(r'_et\d+') + data.root = ET_PATTERN.sub(f'_et{self.specs.et}', data.root) + + # generate successor path this_name = str(data.get_successor(self.specs.iteration, id)) folder, extenstion = this_path diff --git a/sxpat/utils/name.py b/sxpat/utils/name.py index 04458681a..ebe028964 100644 --- a/sxpat/utils/name.py +++ b/sxpat/utils/name.py @@ -1,9 +1,10 @@ from __future__ import annotations -from typing import Any, Mapping, Optional +from typing import Optional from os import PathLike import dataclasses as dc import re +from time import time_ns from Z3Log.config import path as z3logpath from sxpat.config.config import NameParameters @@ -52,7 +53,7 @@ class NameData(PathLike): source_id: Optional[str] = None curr_id: Optional[str] = None - NAME_PATTERN = re.compile(r'(.+)_s(E|i\d+m\d+)_(i\d+m\d+)') + NAME_PATTERN = re.compile(r'(.+)_s(E|i\d+m\d+t\d+)_(i\d+m\d+t\d+)') def __post_init__(self): self.curr_id = self.curr_id or 'E' @@ -65,7 +66,8 @@ def from_filename(cls, filename: str) -> NameData: @staticmethod def gen_id(iteration_number: int, model_number: int) -> str: - return f'i{iteration_number}m{model_number}' + timestamp = str(time_ns())[-15:] + return f'i{iteration_number}m{model_number}t{timestamp}' @property def is_origin(self) -> bool: diff --git a/sxpat/xplore.py b/sxpat/xplore.py index d4d44414d..d13951b16 100644 --- a/sxpat/xplore.py +++ b/sxpat/xplore.py @@ -226,8 +226,6 @@ def explore_grid(specs_obj: Specifications): stats_obj.grid.cells[lpp][ppo].store_model_info(best_model_info) pprint.success(f'ErrorEval PASS! with total wce = {best_data[4]}') - synth_obj.set_path(z3logpath.OUTPUT_PATH['ver'], list(cur_model_results.keys())[0]) - exact_stats = [synth_obj.estimate_area(exact_file_path), synth_obj.estimate_power(exact_file_path), synth_obj.estimate_delay(exact_file_path)]