Skip to content

Commit 89c130a

Browse files
authored
Merge pull request #15 from drazenp/dp/bumpLog4net
Dp/bump log4net
2 parents a9c2788 + 1e5cea9 commit 89c130a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1985
-2056
lines changed
Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
namespace MultiAgentAlgorithmAnalyze
22
{
3-
class AnalyzeData
4-
{
5-
public int ID { get; set; }
6-
7-
public string GraphFilePath { get; set; }
8-
9-
public int NumberOfAnts { get; set; }
10-
11-
public int NumberOfPartitions { get; set; }
12-
13-
public double ColoringProbability { get; set; }
14-
15-
public double MovingProbability { get; set; }
16-
17-
public int NumberOfVerticesForBalance { get; set; }
18-
19-
public int NumberOfIterations { get; set; }
20-
21-
public GraphFileType GraphFileType { get; set; }
22-
}
3+
class AnalyzeData
4+
{
5+
public int ID { get; set; }
6+
public string GraphFilePath { get; set; }
7+
public int NumberOfAnts { get; set; }
8+
public int NumberOfPartitions { get; set; }
9+
public double ColoringProbability { get; set; }
10+
public double MovingProbability { get; set; }
11+
public int NumberOfVerticesForBalance { get; set; }
12+
public int NumberOfIterations { get; set; }
13+
public GraphFileType GraphFileType { get; set; }
14+
}
2315
}

MultiagentAlgorithm/MultiAgentAlgorithmAnalyze/AnalyzeDataAccess.cs

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -4,77 +4,77 @@
44

55
namespace MultiAgentAlgorithmAnalyze
66
{
7-
static class AnalyzeDataAccess
8-
{
9-
private static readonly string ConnectionString = ConfigurationManager.ConnectionStrings["AnalyzeConnectionString"].ConnectionString;
7+
static class AnalyzeDataAccess
8+
{
9+
private static readonly string ConnectionString = ConfigurationManager.ConnectionStrings["AnalyzeConnectionString"].ConnectionString;
1010

11-
public static AnalyzeData GetAnalyzeData()
12-
{
13-
using (var conn = new SQLiteConnection(ConnectionString))
14-
{
15-
const string sqlAnalyzeData = @"select ad.ID, ad.GraphFilePath, ad.InputFileType, ad.NumberOfAnts, ad.NumberOfPartitions, ad.ColoringProbability,
16-
ad.MovingProbability, ad.NumberOfVerticesForBalance, ad.NumberOfIterations, count(ar.AnalyzeID) as NumberOfResults
17-
from AnalyzeData ad
18-
left join AnalyzeResults ar on ar.AnalyzeID=ad.ID
19-
group by ad.ID, ad.GraphFilePath, ad.InputFileType, ad.NumberOfAnts, ad.NumberOfPartitions, ad.ColoringProbability,
20-
ad.MovingProbability, ad.NumberOfVerticesForBalance, ad.NumberOfIterations, ad.TimesToRun
21-
having NumberOfResults<ad.TimesToRun";
11+
public static AnalyzeData GetAnalyzeData()
12+
{
13+
using (var conn = new SQLiteConnection(ConnectionString))
14+
{
15+
const string sqlAnalyzeData = @"select ad.ID, ad.GraphFilePath, ad.InputFileType, ad.NumberOfAnts, ad.NumberOfPartitions, ad.ColoringProbability,
16+
ad.MovingProbability, ad.NumberOfVerticesForBalance, ad.NumberOfIterations, count(ar.AnalyzeID) as NumberOfResults
17+
from AnalyzeData ad
18+
left join AnalyzeResults ar on ar.AnalyzeID=ad.ID
19+
group by ad.ID, ad.GraphFilePath, ad.InputFileType, ad.NumberOfAnts, ad.NumberOfPartitions, ad.ColoringProbability,
20+
ad.MovingProbability, ad.NumberOfVerticesForBalance, ad.NumberOfIterations, ad.TimesToRun
21+
having NumberOfResults<ad.TimesToRun";
2222

23-
using (var cmd = new SQLiteCommand(sqlAnalyzeData, conn))
24-
{
25-
conn.Open();
26-
using (var reader = cmd.ExecuteReader())
27-
{
28-
if (!reader.Read())
29-
{
30-
return null;
31-
}
23+
using (var cmd = new SQLiteCommand(sqlAnalyzeData, conn))
24+
{
25+
conn.Open();
26+
using (var reader = cmd.ExecuteReader())
27+
{
28+
if (!reader.Read())
29+
{
30+
return null;
31+
}
3232

33-
var analyzeData = new AnalyzeData
34-
{
35-
ID = reader.GetInt32(0),
36-
GraphFilePath = reader.GetString(1),
37-
GraphFileType = (GraphFileType) reader.GetInt32(2),
38-
NumberOfAnts = reader.GetInt32(3),
39-
NumberOfPartitions = reader.GetInt32(4),
40-
ColoringProbability = reader.GetDouble(5),
41-
MovingProbability = reader.GetDouble(6),
42-
NumberOfVerticesForBalance = reader.GetInt32(7),
43-
NumberOfIterations = reader.GetInt32(8)
44-
};
33+
var analyzeData = new AnalyzeData
34+
{
35+
ID = reader.GetInt32(0),
36+
GraphFilePath = reader.GetString(1),
37+
GraphFileType = (GraphFileType)reader.GetInt32(2),
38+
NumberOfAnts = reader.GetInt32(3),
39+
NumberOfPartitions = reader.GetInt32(4),
40+
ColoringProbability = reader.GetDouble(5),
41+
MovingProbability = reader.GetDouble(6),
42+
NumberOfVerticesForBalance = reader.GetInt32(7),
43+
NumberOfIterations = reader.GetInt32(8)
44+
};
4545

46-
return analyzeData;
47-
}
48-
}
46+
return analyzeData;
47+
}
4948
}
50-
}
49+
}
50+
}
5151

52-
public static void SaveAnalyzeResult(AnalyzeResult analyzeResult)
53-
{
54-
const string sqlSaveAnalyzeResult = @"insert into AnalyzeResults(AnalyzeID, BestCost, StartDate, EndDate, Duration, BestCostIteration)
52+
public static void SaveAnalyzeResult(AnalyzeResult analyzeResult)
53+
{
54+
const string sqlSaveAnalyzeResult = @"insert into AnalyzeResults(AnalyzeID, BestCost, StartDate, EndDate, Duration, BestCostIteration)
5555
values(@AnalyzeID, @BestCost, @StartDate, @EndDate, @Duration, @BestCostIteration)";
5656

57-
using (var conn = new SQLiteConnection(ConnectionString))
57+
using (var conn = new SQLiteConnection(ConnectionString))
58+
{
59+
conn.Open();
60+
using (var tran = conn.BeginTransaction())
5861
{
59-
conn.Open();
60-
using (var tran = conn.BeginTransaction())
61-
{
62-
using (var cmd = new SQLiteCommand(sqlSaveAnalyzeResult, conn, tran))
63-
{
64-
cmd.Parameters.Add("AnalyzeID", DbType.Int32).Value = analyzeResult.AnalyzeID;
65-
cmd.Parameters.Add("@BestCost", DbType.Int32).Value = analyzeResult.BestCost;
66-
cmd.Parameters.Add("@StartDate", DbType.Int32).Value =
67-
analyzeResult.GetIntegerFromDate(analyzeResult.StartDate);
68-
cmd.Parameters.Add("@EndDate", DbType.Int32).Value =
69-
analyzeResult.GetIntegerFromDate(analyzeResult.EndDate);
70-
cmd.Parameters.Add("@Duration", DbType.Int32).Value = analyzeResult.Duration;
71-
cmd.Parameters.Add("@BestCostIteration", DbType.Int32).Value = analyzeResult.BestCostIteration;
72-
73-
cmd.ExecuteNonQuery();
74-
tran.Commit();
75-
}
76-
}
62+
using (var cmd = new SQLiteCommand(sqlSaveAnalyzeResult, conn, tran))
63+
{
64+
cmd.Parameters.Add("AnalyzeID", DbType.Int32).Value = analyzeResult.AnalyzeID;
65+
cmd.Parameters.Add("@BestCost", DbType.Int32).Value = analyzeResult.BestCost;
66+
cmd.Parameters.Add("@StartDate", DbType.Int32).Value =
67+
analyzeResult.GetIntegerFromDate(analyzeResult.StartDate);
68+
cmd.Parameters.Add("@EndDate", DbType.Int32).Value =
69+
analyzeResult.GetIntegerFromDate(analyzeResult.EndDate);
70+
cmd.Parameters.Add("@Duration", DbType.Int32).Value = analyzeResult.Duration;
71+
cmd.Parameters.Add("@BestCostIteration", DbType.Int32).Value = analyzeResult.BestCostIteration;
72+
73+
cmd.ExecuteNonQuery();
74+
tran.Commit();
75+
}
7776
}
78-
}
79-
}
77+
}
78+
}
79+
}
8080
}

MultiagentAlgorithm/MultiAgentAlgorithmAnalyze/AnalyzeResult.cs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,13 @@
22

33
namespace MultiAgentAlgorithmAnalyze
44
{
5-
partial class AnalyzeResult
6-
{
7-
public int AnalyzeID { get; set; }
8-
9-
public int BestCost { get; set; }
10-
11-
public DateTime StartDate { get; set; }
12-
13-
public DateTime EndDate { get; set; }
14-
15-
public long Duration { get; set; }
16-
17-
public int BestCostIteration { get; set; }
18-
}
5+
partial class AnalyzeResult
6+
{
7+
public int AnalyzeID { get; set; }
8+
public int BestCost { get; set; }
9+
public DateTime StartDate { get; set; }
10+
public DateTime EndDate { get; set; }
11+
public long Duration { get; set; }
12+
public int BestCostIteration { get; set; }
13+
}
1914
}

MultiagentAlgorithm/MultiAgentAlgorithmAnalyze/AnalyzeResultUtility.cs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@
22

33
namespace MultiAgentAlgorithmAnalyze
44
{
5-
partial class AnalyzeResult
6-
{
7-
private static readonly DateTime DateTime1970 = new DateTime(1970, 1, 1);
5+
partial class AnalyzeResult
6+
{
7+
private static readonly DateTime DateTime1970 = new DateTime(1970, 1, 1);
88

9-
public int GetIntegerFromDate(DateTime date)
10-
{
11-
// Integer should be enough.
12-
return (int)(date - DateTime1970).TotalSeconds;
13-
}
9+
public int GetIntegerFromDate(DateTime date)
10+
{
11+
// Integer should be enough.
12+
return (int)(date - DateTime1970).TotalSeconds;
13+
}
1414

15-
public DateTime GetDateTimeFromInteger(int seconds)
16-
{
17-
return DateTime1970.AddSeconds(seconds);
18-
}
15+
public DateTime GetDateTimeFromInteger(int seconds)
16+
{
17+
return DateTime1970.AddSeconds(seconds);
18+
}
1919

20-
public override string ToString()
21-
{
22-
return $@"AnalyzeID {AnalyzeID}
23-
BestCost {BestCost}
24-
StartDate {StartDate}
25-
EndDate {EndDate}
26-
Duration {Duration}
27-
BestCostIteration {BestCostIteration}";
28-
}
29-
}
20+
public override string ToString()
21+
{
22+
return $@"AnalyzeID {AnalyzeID}
23+
BestCost {BestCost}
24+
StartDate {StartDate}
25+
EndDate {EndDate}
26+
Duration {Duration}
27+
BestCostIteration {BestCostIteration}";
28+
}
29+
}
3030
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
namespace MultiAgentAlgorithmAnalyze
22
{
3-
public enum GraphFileType
4-
{
5-
Dimacs,
6-
Metis
7-
}
3+
public enum GraphFileType
4+
{
5+
Dimacs,
6+
Metis
7+
}
88
}

MultiagentAlgorithm/MultiAgentAlgorithmAnalyze/MultiAgentAlgorithmAnalyze.csproj

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@
4040
<Reference Include="System" />
4141
<Reference Include="System.configuration" />
4242
<Reference Include="System.Core" />
43-
<Reference Include="System.Data.SQLite, Version=1.0.101.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
44-
<HintPath>..\packages\System.Data.SQLite.Core.1.0.101.0\lib\net45\System.Data.SQLite.dll</HintPath>
45-
<Private>True</Private>
43+
<Reference Include="System.Data.SQLite, Version=1.0.113.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
44+
<HintPath>..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\lib\net45\System.Data.SQLite.dll</HintPath>
4645
</Reference>
4746
<Reference Include="System.Xml.Linq" />
4847
<Reference Include="System.Data.DataSetExtensions" />
@@ -178,12 +177,12 @@
178177
<Content Include="db\script.sql" />
179178
</ItemGroup>
180179
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
181-
<Import Project="..\packages\System.Data.SQLite.Core.1.0.101.0\build\net45\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.101.0\build\net45\System.Data.SQLite.Core.targets')" />
180+
<Import Project="..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\build\net45\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\build\net45\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
182181
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
183182
<PropertyGroup>
184183
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
185184
</PropertyGroup>
186-
<Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.101.0\build\net45\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.101.0\build\net45\System.Data.SQLite.Core.targets'))" />
185+
<Error Condition="!Exists('..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\build\net45\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\build\net45\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
187186
</Target>
188187
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
189188
Other similar extension points exist, see Microsoft.Common.targets.

0 commit comments

Comments
 (0)