Formally, the Generalized Assignment Problem can be defined as follows:
Given:
A set of tasks, \(T = \{1, 2, ..., n\}\)
A set of agents, \(A = \{1, 2, ..., m\}\)
For each task \(i\) and agent \(j\), a cost or profit \(c_{ij}\) associated with assigning task \(i\) to agent \(j\)
For each task \(i\) and agent \(j\), a resource requirement \(r_{ij}\) specifying the amount of resource needed from agent \(j\) to complete task \(i\)
For each agent \(j\), a capacity \(b_j\) specifying the maximum amount of resource that agent \(j\) can contribute
The goal is to find an assignment of tasks to agents that minimizes the total cost or maximizes the total profit, while ensuring that each task is assigned to one or more agents, and the total resource requirement of each agent does not exceed its capacity.
Mathematically, the GAP can be formulated as an integer linear programming problem. One possible formulation is as follows:
where \(x_{ij}\) is a binary decision variable that equals 1 if task \(i\) is assigned to agent \(j\), and 0 otherwise.
The first set of constraints ensures that each task is assigned to exactly one agent, and the second set of constraints ensures that the total resource requirement of each agent does not exceed its capacity.
Solving the GAP can be computationally challenging, especially for large instances, as it is a generalization of the classic assignment problem, which is known to be polynomial-time solvable. Various algorithms and heuristics, such as branch and bound, dynamic programming, and approximation algorithms, can be employed to find feasible or optimal solutions to the GAP.
5.2 Benchmarking Problems
There are benchmarking problems available here. Listing 5.1 shows one of the instance file with five instances in it.
Listing 5.2 contains the Java class to hold the content of an instance. The class contains a couple of key information:
numTasks: the total number of tasks in the instance.
numAgents: the total number of agents available to process the tasks.
costs: a two-dimensional array with costs[i][j] representing the cost of assigning task j to agent i.
resources: a two-dimensional array with resources[i][j] representing the resource requirement of assigning task j to agent i.
capacities: a one-dimensional array with capacities[i] representing the capacity of agent i.
Listing 5.3 gives a Java class that reads the instance file and outputs a list of GapInstance objects.