-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
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
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(); | ||
} | ||
} | ||
} | ||
} |