Пример #1
0
    def run_solver(self, dirs=None):
        if not dirs:
            path = Path(self.cfg["dataset_path"])
            dirs = list(path.iterdir())
            shuffle(dirs)  # Shuffle to sample a different file each time

        else:
            path = Path(self.cfg["dataset_path"])
            child = dirs


#         for child in dirs:
#         print(child)
        print(
            f"Process PID: {os.getpid()} ---------------- Number of threads: {active_count()}"
        )
        self.results[str(child).split("/")[-1]] = run_aifeynman(
            pathdir=str(path.resolve()) + "/",
            filename=str(child).split("/")[-1],
            BF_try_time=int(self.cfg["bruteforce_time"]),
            BF_ops_file_type=Path(self.cfg["operations_file"]),
            polyfit_deg=int(self.cfg["polynomial_degree"]),
            NN_epochs=int(self.cfg["number_of_epochs"]),
            vars_name=[],
            test_percentage=int(self.cfg["test_percentage"]),
        )

        logging.info(self.results)
        print("@" * 120)
        print("@" * 120)

        self.print_results()
    default="14ops.txt",
    help="File containing the symbols to be used in the brute force code")
parser.add_argument(
    "--polyfit_deg",
    type=int,
    default=4,
    help="Maximum degree of the polynomial tried by the polynomial fit routine"
)
parser.add_argument("--NN_epochs",
                    type=int,
                    default=2000,
                    help="Number of epochs for the training")
parser.add_argument("--vars_name",
                    type=list,
                    default=[],
                    help="List with the names of the variables")
parser.add_argument(
    "--test_percentage",
    type=float,
    default=0,
    help="Percentage of the input data to be kept as the test set")

opts = parser.parse_args()

run_aifeynman(opts.pathdir,
              opts.filename,
              BF_try_time=opts.BF_try_time,
              BF_ops_file_type=opts.BF_ops_file_type,
              polyfit_deg=opts.polyfit_deg,
              NN_epochs=opts.NN_epochs)
parser.add_argument(
    "--polyfit_deg",
    type=int,
    default=3,
    help="Maximum degree of the polynomial tried by the polynomial fit routine"
)
parser.add_argument("--NN_epochs",
                    type=int,
                    default=2000,
                    help="Number of epochs for the training")
parser.add_argument("--vars_name",
                    type=list,
                    default=[],
                    help="List with the names of the variables")
parser.add_argument(
    "--test_percentage",
    type=float,
    default=0,
    help="Percentage of the input data to be kept as the test set")

opts = parser.parse_args()

run_aifeynman(opts.pathdir,
              opts.filename,
              BF_try_time=opts.BF_try_time,
              BF_ops_file_type=opts.BF_ops_file_type,
              polyfit_deg=opts.polyfit_deg,
              NN_epochs=opts.NN_epochs,
              vars_name=opts.vars_name,
              test_percentage=opts.test_percentage)
Пример #4
0
from S_run_aifeynman import run_aifeynman

run_aifeynman("../example_data/","example3.txt",30,"14ops.txt", polyfit_deg=4, NN_epochs=400)