8.1. Introduction to AP
AP deal with the question how to assign n objects to m other objects in the best possible way. Best possible way can be represent optimal (with minimum or maximum) value of the objective function. Most of the APs have m>n which means that assignment operation deals with not equally numbers of objects. All such a problems can be transformed to m=n, by adding fake assignment operations.
One example of AP can be formulate as follow: Suppose that a taxi firm has three taxis (the agents) available, and three customers (the tasks) wishing to be picked up as soon as possible. The firm prides itself on speedy pickups, so for each taxi the “cost” of picking up a particular customer will depend on the time taken for the taxi to reach the pickup point. The solution to the assignment problem will be whichever combination of taxis and customers results in the least total cost.
However, the assignment problem can be made rather more flexible than it first appears. In the above example, suppose that there are four taxis available, but still only three customers. Then a fourth dummy task can be invented, perhaps called “sitting still doing nothing”, with a cost of 0 for the taxi assigned to it. The assignment problem can then be solved in the usual way and still give the best solution to the problem.
Similar tricks can be played in order to allow more tasks than agents, tasks to which multiple agents must be assigned (for instance, a group of more customers than will fit in one taxi), or maximizing profit rather than minimizing cost.
The formal definition of the assignment problem (or linear assignment problem) is
Given two sets, A and T, of equal size, together with a weight function C: A × T → R. Find a bijection f: A → T such that the cost function:
is minimized.
Usually the weight function is viewed as a square realvalued matrix C, so that the cost function is written down as:
Subject to the constants
The variable represents the assignment of agent to task, taking value 1 if the assignment is done and 0 otherwise. This formulation allows also fractional variable values, but there is always an optimal solution where the variables take integer values. This is because the constraint matrix is totally unimodular. The first constraint requires that every agent is assigned to exactly one task, and the second constraint requires that every task is assigned exactly one agent.
8.2 AP in GPdotNET
Solving AP with GPdotNET begins by clicking “New” button from Application Bar, and selecting AP Solver from New GPModel dialog (see pic. below).
Figure 14 Creating new AP Model in GPdotNET
After clicking OK button, GPdotNET shows several tab pages similar on the following picture.
The first step in defining AP in GPdotNET is loading data of the problem.
8.2.1 Preparing and loading data in AP
As we can see from introduction data for AP problem must be in matrix form, so the following picture can represent proper format of AP data.
In GPdotNET v3 and late you can put comments in data file. The picture above contains three lines of comments which will not be loaded. Then we have 5 lines represent rows in AP. Columns are divided by semicolon. From the picture above it can be seen “M” letter in the middle of the data. “M” represent maximum number (infinity number). Other symbol which can be seen in data is “L” which represents the minimum value (negative infinity). Decision when to put M or L letter depends of the solution.

If we want to find minimum cost of AP and want to put fake row in order to define closed solution, we can put M letter.

If we want to find maximum cost of AP and want to put fake row in order to define closed solution, we can put L letter.
8.3. Running AP problem with GPdotNET
When the data is loaded we can start by defining GP parameters and start with finding solution. The process is identical like other, so this step we will not be describe. After we start finding solution by clicking START button, we can see that GPdotNET find solution very quickly. The picture below show solution for problem we have described above.
As we can see from the picture above, result is shown as array of number. Actually, result is presented as vector, which position of number represent column, and the value represent the row of started problem. From the picture above result is [2 5 1 4 3]
which means the following results:
Vector number represent the row index, and position means column index.