DIMACS assignment problemsDIMACS (Center for Discrete Mathematics and Theoretical Computer Science (see http://dimacs.rutgers.edu/)) has formulated some 'challenges' for some specific problem instances (see http://dimacs.rutgers.edu/Challenges/). One of these challenges is network flows and matching - the first DIMACS implementation challenge. One of these network flows are assignment problems: Network Structure
There is a specific file format available for these kinds of problems: The following information makes up a DIMACS assignment problem input file:
As noted above, information is collected into lines, which begin with one-character designators. We describe each type of information line in turn.
Input File Example :Consider the table below which shows the cost of allocating 5 jobs to 5 machines. Machine 6 7 8 9 10 Job 1 22 30 26 16 25 2 27 29 28 20 32 3 33 25 21 29 23 4 24 24 30 19 26 5 30 33 32 37 31 Which jobs should be allocated to which machines so as to minimise the total cost?
Problems of this type are called assignment problems since they involve the assignment of n (in this case n=5) distinct entities to another n distinct entities. For example in the area of production planning we might be interested in assigning operators to machines, or in assigning operators to jobs, or (as above) in assigning jobs to machines. c This is a simple example file to demonstrate the DIMACS c input file format for assignment problems. c c Problem line (resources+tasks) (resources*tasks) p asn 10 25 c c Node descriptor lines (indeces of assignable resources only) n 1 n 2 n 3 n 4 n 5 c c Arc descriptor lines (tasks over each resource and "score") a 1 6 22 a 1 7 30 a 1 8 26 a 1 9 16 a 1 10 25 a 2 6 27 a 2 7 29 a 2 8 28 a 2 9 20 a 2 10 32 a 3 6 33 a 3 7 25 a 3 8 21 a 3 9 29 a 3 10 23 a 4 6 24 a 4 7 24 a 4 8 30 a 4 9 19 a 4 10 26 a 5 6 30 a 5 7 33 a 5 8 32 a 5 9 37 a 5 10 31 c c End of file lp_solve can read/write and solve these models via the xli_DIMACS XLI driver (see External Language Interfaces).
It reads such a model in above format and solves it via linear programming.
The xli can also generate a DIMACS formatted file. lp_solve -rxli xli_DIMACS assignment.net This gives as result: Value of objective function: 118 Actual values of the variables: C1 1 C2 0 C3 0 C4 0 C5 0 C6 0 C7 0 C8 0 C9 1 C10 0 C11 0 C12 0 C13 1 C14 0 C15 0 C16 0 C17 1 C18 0 C19 0 C20 0 C21 0 C22 0 C23 0 C24 0 C25 1 Also from within the IDE, this XLI can be used. However, some entries must be added in LpSolveIDE.ini (in the folder where the IDE is installed). In the [XLI] section the following must be added: lib6=xli_DIMACS And a new section for the DIMACS XLI must also be added: [xli_DIMACS] extension=.net language=DIMACS Then make sure that the xli_DIMACS.dll is available for the IDE. This must be done by placing this dll in the IDE folder or in the Windows system32 folder. Solution :The solution vector of above example is [1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1] Output :The solution of the model can also be written in a DIMACS format:
For each network problem, the solution is an integer-valued flow assignment. The output file should list the solution and flow assignment for all arcs in the graph. As noted above, information is collected into lines, which begin with one-character designators. We describe each type of information line in turn.
lp_solve can generate a solution file via the xli_DIMACS XLI driver (see External Language Interfaces). lp_solve -rxli xli_DIMACS assignment.net -wxlisol xli_DIMACS assignment.sol This generates the following solution contents: c assignment.net c c Dimacs-format network assignment result file c generated by lp_solve c c Solution s 118 c c SRC DST FLOW f 1 6 1 f 1 7 0 f 1 8 0 f 1 9 0 f 1 10 0 f 2 6 0 f 2 7 0 f 2 8 0 f 2 9 1 f 2 10 0 f 3 6 0 f 3 7 0 f 3 8 1 f 3 9 0 f 3 10 0 f 4 6 0 f 4 7 1 f 4 8 0 f 4 9 0 f 4 10 0 f 5 6 0 f 5 7 0 f 5 8 0 f 5 9 0 f 5 10 1 c c End of file lp_solve can also generate a solution file with only non-zero values. lp_solve -rxli xli_DIMACS assignment.net -wxlisol xli_DIMACS assignment.sol -wxlisolopt "-nz" This generates the following solution contents: c assignment.net c c Dimacs-format network assignment result file c generated by lp_solve c c Solution s 118 c c Only non-zero flows are written c SRC DST FLOW f 1 6 1 f 2 9 1 f 3 8 1 f 4 7 1 f 5 10 1 c c End of file See Also DIMACS minimum cost flow problems, DIMACS maximum flow problems |