-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added performance threshold test with newly created test, modified RE…
…ADME
- Loading branch information
1 parent
3a8cc0a
commit 49129ef
Showing
6 changed files
with
450 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
JobShopScheduling.Tests/JobShopGeneticAlgorithmPerformanceThresholdTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using GeneticSharp.Domain.Randomizations; | ||
using JobShopScheduling.JobShopStructures; | ||
using Moq; | ||
using NUnit.Framework; | ||
using Serilog; | ||
|
||
namespace JobShopScheduling.Tests | ||
{ | ||
/// <summary> | ||
/// Checks whether it can find the best result on easy tasks. This test is a lower performance threshold for the algorithm. | ||
/// </summary> | ||
/// <remarks> | ||
/// There is no easy option to set a fixed seed unfortunately in GeneticSharp Random Provider, but the test should still work | ||
/// even with bad seeds. | ||
/// </remarks> | ||
[TestFixture] | ||
public class JobShopGeneticAlgorithmPerformanceThresholdTests | ||
{ | ||
/// <summary> | ||
/// Runs performance threshold test. | ||
/// | ||
/// This configurations graph is depicted in test2.graphml graph file with arrows specifying order of machine evaluation. | ||
/// </summary> | ||
[Test] | ||
public void RunTest() | ||
{ | ||
var jobShop = new JobShopLoader().Load("TestExamples/test2.in"); | ||
var mockLogger = new Mock<ILogger>(); | ||
|
||
var ga = new JobShopGeneticAlgorithm(jobShop, 1, mockLogger.Object, adaptive: false); | ||
|
||
Global.Config.MinPopulationSize = 100; | ||
Global.Config.MaxPopulationSize = 100; | ||
Global.Config.GenerationsCount = 100; | ||
Global.Config.CrossoverProbability = 0.75f; | ||
Global.Config.MutationProbability = 0.3f; | ||
Global.Config.MutationPerGeneProbability = 0.01f; | ||
Global.Config.ElitismPercent = 0.02f; | ||
|
||
ga.Run(); | ||
|
||
int expectedScheduleLength = 26; | ||
Assert.That(ga.BestSchedule.ScheduleLength, Is.EqualTo(expectedScheduleLength)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.