solve_assignment_problem_tool
Optimize task assignments using the Hungarian algorithm. Input workers, tasks, and cost matrix to minimize or maximize costs. Specify constraints like max/min tasks per worker for tailored solutions.
Instructions
Solve assignment problem using OR-Tools Hungarian algorithm.
Args:
workers: List of worker names
tasks: List of task names
costs: 2D cost matrix where costs[i][j] is cost of assigning worker i to task j
maximize: Whether to maximize instead of minimize (default: False)
max_tasks_per_worker: Maximum tasks per worker (optional)
min_tasks_per_worker: Minimum tasks per worker (optional)
Returns:
Dictionary with solution status, assignments, total cost, and execution time
Input Schema
Name | Required | Description | Default |
---|---|---|---|
costs | Yes | ||
max_tasks_per_worker | No | ||
maximize | No | ||
min_tasks_per_worker | No | ||
tasks | Yes | ||
workers | Yes |
Input Schema (JSON Schema)
{
"properties": {
"costs": {
"items": {
"items": {
"type": "number"
},
"type": "array"
},
"title": "Costs",
"type": "array"
},
"max_tasks_per_worker": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Max Tasks Per Worker"
},
"maximize": {
"default": false,
"title": "Maximize",
"type": "boolean"
},
"min_tasks_per_worker": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Min Tasks Per Worker"
},
"tasks": {
"items": {
"type": "string"
},
"title": "Tasks",
"type": "array"
},
"workers": {
"items": {
"type": "string"
},
"title": "Workers",
"type": "array"
}
},
"required": [
"workers",
"tasks",
"costs"
],
"type": "object"
}