1
#region License Information
3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
5 * This file is part of HeuristicLab.
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
22 using HeuristicLab
.Data
;
23 using HeuristicLab
.Encodings
.PermutationEncoding
;
24 using Microsoft
.VisualStudio
.TestTools
.UnitTesting
;
26 namespace HeuristicLab
.Problems
.LinearAssignment
.Tests
{
28 ///This is a test class for LinearAssignmentProblemSolverTest and is intended
29 ///to contain all LinearAssignmentProblemSolverTest Unit Tests
32 public class LinearAssignmentProblemSolverTest
{
37 [TestCategory("Problems.Assignment")]
38 [TestProperty("Time", "short")]
39 public void SolveTest() {
40 double[,] costs
= new double[,] {
47 p
= new Permutation(PermutationTypes
.Absolute
, LinearAssignmentProblemSolver
.Solve(new DoubleMatrix(costs
), out quality
));
48 Assert
.AreEqual(18, quality
);
49 Assert
.IsTrue(p
.Validate());
51 costs
= new double[,] {
52 { 11, 7, 10, 17, 10 }
,
53 { 13, 21, 7, 11, 13 }
,
54 { 13, 13, 15, 13, 14 }
,
55 { 18, 10, 13, 16, 14 }
,
56 { 12, 8, 16, 19, 10 }}
;
58 p
= new Permutation(PermutationTypes
.Absolute
, LinearAssignmentProblemSolver
.Solve(new DoubleMatrix(costs
), out quality
));
59 Assert
.AreEqual(51, quality
);
60 Assert
.IsTrue(p
.Validate());
62 costs
= new double[,] {
68 p
= new Permutation(PermutationTypes
.Absolute
, LinearAssignmentProblemSolver
.Solve(new DoubleMatrix(costs
), out quality
));
69 Assert
.AreEqual(13, quality
);
70 Assert
.IsTrue(p
.Validate());