Skip to content

Commit 69498a5

Browse files
committed
Removed logging.
1 parent 1cb8b4e commit 69498a5

File tree

3 files changed

+4
-35
lines changed

3 files changed

+4
-35
lines changed

MultiagentAlgorithm/MultiagentAlgorithm/Algorithm.cs

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace MultiagentAlgorithm
88
{
99
public static class Algorithm
1010
{
11-
private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
11+
//private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
1212

1313
public static ResultData Run(BaseGraph graph, Options options, Random rnd, IExportGraph graphExport)
1414
{
@@ -22,10 +22,8 @@ public static ResultData Run(BaseGraph graph, Options options, Random rnd, IExpo
2222

2323
var bestCost = graph.GetGlobalCostFunction();
2424
var bestCostIteration = 0;
25-
var bestDistribution = (Vertex[])graph.Vertices.Clone();
26-
Log.Info($"Initial global cost: {bestCost}");
27-
2825
var iteration = 0;
26+
2927
while(bestCost > 0 && iteration < options.NumberOfIterations)
3028
{
3129
// At a given iteration each ant moves from the current position
@@ -78,29 +76,13 @@ public static ResultData Run(BaseGraph graph, Options options, Random rnd, IExpo
7876
{
7977
bestCost = globalCost;
8078
bestCostIteration = iteration;
81-
bestDistribution = (Vertex[])graph.Vertices.Clone();
8279
}
83-
Log.Info($"Iteration [{iteration}] | Ant {ant} | Global cost: {globalCost} | Best cost: {bestCost}");
8480
}
8581
iteration++;
8682
}
8783
stopwatch.Stop();
8884

8985
var result = new ResultData(bestCost, bestCostIteration, stopwatch.ElapsedMilliseconds);
90-
Log.Info(result.ToString());
91-
92-
if (Log.IsDebugEnabled)
93-
{
94-
foreach (var partition in Enumerable.Range(1, options.NumberOfPartitions))
95-
{
96-
var numberOfVerticesWithinPartition = bestDistribution.Count(vertex => vertex.Color == partition);
97-
Log.Debug($"Partition [{partition}]: {numberOfVerticesWithinPartition}");
98-
}
99-
}
100-
LoggerHelper.LogVertices(bestDistribution);
101-
LoggerHelper.LogVerticesOneLine(bestDistribution);
102-
graphExport.ExportGraph(bestDistribution);
103-
//LoggerHelper.LogChangesOnVertices(graph.changes);
10486

10587
return result;
10688
}

MultiagentAlgorithm/MultiagentAlgorithm/BaseGraph.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4-
using System.Reflection;
5-
using log4net;
4+
//using System.Reflection;
5+
//using log4net;
66

77
namespace MultiagentAlgorithm
88
{
99
public abstract class BaseGraph : IGraph
1010
{
11-
private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
12-
1311
protected IDataLoader DataLoader;
1412

1513
protected Random Rnd;
@@ -101,11 +99,6 @@ private void CalculateLocalCostFunctionForVertex(Vertex vertex)
10199
/// <returns>The value of global cost function.</returns>
102100
public int GetGlobalCostFunction()
103101
{
104-
if (Log.IsDebugEnabled)
105-
{
106-
LoggerHelper.LogVertices(Vertices);
107-
}
108-
109102
var globalCost = 0;
110103

111104
foreach (var vertex in Vertices)

MultiagentAlgorithm/MultiagentAlgorithm/ExtensionMethods.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4-
using System.Reflection;
5-
using log4net;
6-
74
namespace MultiagentAlgorithm
85
{
96
public static class ExtensionMethods
107
{
11-
public static ILog Log { get; } = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
12-
138
// http://stackoverflow.com/a/1287572/1033764
149
public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source, Random rng)
1510
{
16-
Log.Debug("Start");
1711
T[] elements = source.ToArray();
1812
for (var i = elements.Length - 1; i >= 0; i--)
1913
{

0 commit comments

Comments
 (0)