feat: solve() accepts objective_factors and objective_mode
Add objective_factors and objective_mode as optional parameters to solve(). Resolve defaults at function entry and validate using existing _validate_objective. Normalize objective_factors to ensure all required keys (EBSC) are present. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8a775dd941
commit
ead700adf4
1 changed files with 10 additions and 0 deletions
10
solve.py
10
solve.py
|
|
@ -1015,8 +1015,18 @@ def solve(
|
|||
verbose=True,
|
||||
fixed_choices=FIXED_CHOICES,
|
||||
resource_constraints=None,
|
||||
objective_factors=None,
|
||||
objective_mode=None,
|
||||
):
|
||||
|
||||
if objective_factors is None:
|
||||
objective_factors = OBJECTIVE_FACTORS
|
||||
if objective_mode is None:
|
||||
objective_mode = OBJECTIVE_MODE
|
||||
_validate_objective(objective_factors, objective_mode)
|
||||
# Normalized copy: every key present, missing keys = 0.
|
||||
obj_factors = {k: objective_factors.get(k, 0) for k in "EBSC"}
|
||||
|
||||
# ---- build the city list -----------------------------------------
|
||||
# cities: list[tuple[int, dict]] where the dict has keys "type" and
|
||||
# "adjacent_to". TODO: adjacency unused; for Industrialist agent.
|
||||
|
|
|
|||
Loading…
Reference in a new issue