Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mcychan authored Mar 1, 2023
1 parent df0842e commit 3f503c3
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/hk/edu/gaSchedule/ConsoleApp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System.Diagnostics;
using System.IO;
using System.Reflection;

using GaSchedule.Algorithm;
using GaSchedule.Model;

[assembly: AssemblyVersionAttribute("1.2.3")]
namespace GaSchedule
{
class ConsoleApp
{
static void Main(string[] args)
{
Stopwatch stopwatch = Stopwatch.StartNew();

var FILE_NAME = args.Length > 0 ? args[0] : "GaSchedule.json";
var configuration = new Configuration();
configuration.ParseFile(FILE_NAME);

var alg = new APNsgaIII<Schedule>(new Schedule(configuration));
// var alg = new Amga2<Schedule>(new Schedule(configuration));

System.Console.WriteLine("GaSchedule Version {0} C# .NET Core. Making a Class Schedule Using {1}.", Assembly.GetExecutingAssembly().GetName().Version, alg.ToString());
System.Console.WriteLine("Copyright (C) 2022 - 2023 Miller Cy Chan.");

alg.Run();
var htmlResult = HtmlOutput.GetResult(alg.Result);

var tempFilePath = Path.GetTempPath() + FILE_NAME.Replace(".json", ".htm");
using (StreamWriter outputFile = new StreamWriter(tempFilePath))
{
outputFile.WriteLine(htmlResult);
}
System.Console.WriteLine("");
System.Console.WriteLine(@"Completed in {0:s\.fff} secs with peak memory usage of {1}.", stopwatch.Elapsed, Process.GetCurrentProcess().PeakWorkingSet64.ToString("#,#"));

using (var proc = new Process())
{
proc.StartInfo.FileName = tempFilePath;
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.Verb = "open";
proc.Start();
}
}
}
}

0 comments on commit 3f503c3

Please sign in to comment.