fix: Restore default number of workers

OR-Tools 9.3 no longer seems to use more than one worker by default, so
this parameter is once again set by the script.

The parameter has also been changed from num_search_workers to
num_workers internally, though the former is mapped to the latter.
This commit is contained in:
Jeremy Saklad 2022-04-19 10:02:03 -05:00
parent a074b44b87
commit 57a2e9ce36
Signed by: Jeremy Saklad
GPG Key ID: 94B02EA3D0B6481B
1 changed files with 3 additions and 2 deletions

View File

@ -4,6 +4,7 @@ __all__ = ['Adjustment', 'Appendage', 'Buyer', 'Declaration', 'DiplomatFascinati
__author__ = "Jeremy Saklad"
from functools import partialmethod
from os import cpu_count
from ortools.sat.python import cp_model
@ -30,7 +31,7 @@ MAXIMUM_ATTRIBUTE = 100
DIFFICULTY_SCALER = 0.6
def Solve(shadowy_level, bone_market_fluctuations = None, zoological_mania = None, occasional_buyer = None, diplomat_fascination = None, desired_buyers = [], maximum_cost = cp_model.INT32_MAX, maximum_exhaustion = cp_model.INT32_MAX, time_limit = float('inf'), workers = None, blacklist = [], stdscr = None):
def Solve(shadowy_level, bone_market_fluctuations = None, zoological_mania = None, occasional_buyer = None, diplomat_fascination = None, desired_buyers = [], maximum_cost = cp_model.INT32_MAX, maximum_exhaustion = cp_model.INT32_MAX, time_limit = float('inf'), workers = cpu_count(), blacklist = [], stdscr = None):
model = BoneMarketModel()
actions = {}
@ -1099,7 +1100,7 @@ Exhaustion: {solver.Value(exhaustion):n}"""
solver = cp_model.CpSolver()
if workers:
solver.parameters.num_search_workers = workers
solver.parameters.num_workers = workers
solver.parameters.max_time_in_seconds = time_limit
# There's no window in verbose mode