Worker Hours Allocation#
Source: examples/optimization/worker_hours_allocation.py
Introduction#
Inspect the compact competing-projects worker-hours allocation benchmark.
Technical Implementation#
This page is generated from the top-of-file module docstring and the example source code. The full script is included below for direct inspection.
1from __future__ import annotations
2
3import design_research_problems as derp
4
5
6def main() -> None:
7 """Print one decoded baseline allocation and the greedy solver result."""
8 problem = derp.get_problem("worker_hours_competing_projects_value_tracking_min")
9 initial = problem.generate_initial_solution()
10 initial_state = problem.decode_candidate(initial)
11 result = problem.solve()
12 solved_state = problem.decode_candidate(result.x)
13
14 print("Competing-projects worker-hours benchmark")
15 print("task_count", len(problem.task_names))
16 print("worker_count", len(problem.worker_names))
17 print("initial_tracking_error", round(initial_state.tracking_error, 4))
18 print("initial_completed_tasks", initial_state.completed_task_count)
19 print("solved_tracking_error", round(solved_state.tracking_error, 4))
20 print("solved_inactive_hours", round(solved_state.inactive_hours, 4))
21 print("solved_total_achieved_value", round(solved_state.total_achieved_value, 4))
22 print("success", result.success)
23 print("message", result.message)
24
25
26if __name__ == "__main__":
27 main()
Expected Results#
Run Command
PYTHONPATH=src python3 examples/optimization/worker_hours_allocation.py
Run the command shown below from repository root. Output should summarize the problem setup, a baseline solution, or diagnostic values relevant to this example.