Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time based termination not working #640

Open
acheong08 opened this issue Sep 6, 2024 · 1 comment
Open

Time based termination not working #640

acheong08 opened this issue Sep 6, 2024 · 1 comment
Assignees

Comments

@acheong08
Copy link

if __name__ == "__main__":

    initial_solution = actions_to_np(get_solution(f"merged/{SEED}.json"))
    algorithm = PatternSearch(x0=initial_solution)
    np.random.seed(2281)
    demand = get_demand()
    problem = MyProblem(demand)
    termination = get_termination("time", 1)
    res: None | Any = minimize(problem, algorithm, termination, verbose=True)  # type: ignore[reportUnknownVariableType]
    if res is None or res.X is None:
        print("No solution found")
        exit()
    best_solution = problem.decode_actions(res.X)
    best_score = Evaluator(
        best_solution, demand, SERVER_MAP, DATACENTER_MAP, SELLING_PRICES_MAP
    ).get_score()
    print(f"Best score: {best_score}")

This doesn't terminate. Swapping the value to 0.x terminates instantly.

@blankjul blankjul self-assigned this Sep 22, 2024
@blankjul
Copy link
Collaborator

Does providing the full string solve this issue?

termination = get_termination("time", "00:00:03")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants