diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore index 2949627..9491a2f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,363 @@ -/.vscode -/bin +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Oo]ut/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd \ No newline at end of file diff --git a/BusinessLogic/Algorithms/Algorithm.cs b/BusinessLogic/Algorithms/Algorithm.cs new file mode 100644 index 0000000..20a1452 --- /dev/null +++ b/BusinessLogic/Algorithms/Algorithm.cs @@ -0,0 +1,15 @@ +using Common; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BusinessLogic.Algorithms +{ + public abstract class Algorithm + { + public abstract void PutModelInCanonicalForm(Model model); + public abstract void Solve(Model model); + } +} diff --git a/BusinessLogic/Algorithms/BranchAndBoundSimplex.cs b/BusinessLogic/Algorithms/BranchAndBoundSimplex.cs new file mode 100644 index 0000000..65d70e9 --- /dev/null +++ b/BusinessLogic/Algorithms/BranchAndBoundSimplex.cs @@ -0,0 +1,293 @@ +using Common; +using Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BusinessLogic.Algorithms +{ + public class BranchAndBoundSimplex : Algorithm + { + private Model model; + public BinaryTree Results { get; set; } = new BinaryTree(); + private DualSimplex dualSimplex = new DualSimplex(); + private List>> candidateSolutions = new List>>(); + + public override void PutModelInCanonicalForm(Model model) + { + dualSimplex.PutModelInCanonicalForm(model); + Results.Add(model.Result); + } + + public override void Solve(Model model) + { + this.model = model; + + int level = 1; + while (level <= Results.GetHeight(Results.Root)) + { + SolveCurrentLevel(Results.Root, level); + level++; + } + } + + private void SolveCurrentLevel(BinaryTreeNode root, int level) + { + if (root == null) + return; + + if (level == 1) + { + try + { + Solve(root); + Branch(root); + } + catch (InfeasibleException) + { + return; + } + } + else if (level > 1) + { + SolveCurrentLevel(root.LeftNode, level - 1); + SolveCurrentLevel(root.RightNode, level - 1); + } + } + + public List> GetBestCandidate() + { + double bestRHS = candidateSolutions[0][0][candidateSolutions[0][0].Count - 1]; + List> bestSolution = candidateSolutions[0]; + + for (int i = 1; i < candidateSolutions.Count; i++) + { + if (model.ProblemType == ProblemType.Maximization) + { + if (candidateSolutions[i][0][candidateSolutions[i][0].Count - 1] > bestRHS) + { + bestRHS = candidateSolutions[i][0][candidateSolutions[i][0].Count - 1]; + bestSolution = candidateSolutions[i]; + } + } + else + { + if (candidateSolutions[i][0][candidateSolutions[i][0].Count - 1] < bestRHS) + { + bestRHS = candidateSolutions[i][0][candidateSolutions[i][0].Count - 1]; + bestSolution = candidateSolutions[i]; + } + } + } + + return bestSolution; + } + + private void Solve(BinaryTreeNode root) + { + var model = new Model() { ProblemType = this.model.ProblemType, Result = root.Data }; + dualSimplex.Solve(model); + } + + private void Branch(BinaryTreeNode root) + { + if (CanBranch(root).Count == 0) + { + candidateSolutions.Add(root.Data[root.Data.Count - 1]); + } + else + { + // Get the variable we need to branch on + int branchVariableIndex = GetBranchVariable(root.Data[root.Data.Count - 1], CanBranch(root)); + // Add the new constraints to the old table and add that resulting table to the binary tree + AddSubProblems(root, branchVariableIndex); + } + } + + private void AddSubProblems(BinaryTreeNode root, int branchVariableIndex) + { + var table = root.Data[root.Data.Count - 1]; + double rhs = GetRhsOfVariable(branchVariableIndex, table); + + int constraintOneRhs; + int constraintTwoRhs; + + constraintOneRhs = (int)Math.Truncate(rhs); + constraintTwoRhs = constraintOneRhs + 1; + + var subProblemOneTable = ListCloner.CloneList(table); + var subProblemTwoTable = ListCloner.CloneList(table); + + subProblemOneTable.Add(new List()); + subProblemTwoTable.Add(new List()); + + for (int i = 0; i < subProblemOneTable[0].Count - 1; i++) + { + if (i == branchVariableIndex) + { + subProblemOneTable[subProblemOneTable.Count - 1].Add(1); + subProblemTwoTable[subProblemTwoTable.Count - 1].Add(-1); + } + else + { + subProblemOneTable[subProblemOneTable.Count - 1].Add(0); + subProblemTwoTable[subProblemTwoTable.Count - 1].Add(0); + } + } + + subProblemOneTable[subProblemOneTable.Count - 1].Add(constraintOneRhs); + subProblemTwoTable[subProblemTwoTable.Count - 1].Add(constraintTwoRhs * -1); + + for (int i = 0; i < subProblemOneTable.Count; i++) + { + var tempOne = subProblemOneTable[i][subProblemOneTable[i].Count - 1]; + var tempTwo = subProblemTwoTable[i][subProblemTwoTable[i].Count - 1]; + + if (i == subProblemOneTable.Count - 1) + { + subProblemOneTable[i][subProblemOneTable[i].Count - 1] = 1; + subProblemTwoTable[i][subProblemTwoTable[i].Count - 1] = 1; + } + else + { + subProblemOneTable[i][subProblemOneTable[i].Count - 1] = 0; + subProblemTwoTable[i][subProblemTwoTable[i].Count - 1] = 0; + } + + subProblemOneTable[i].Add(tempOne); + subProblemTwoTable[i].Add(tempTwo); + } + + int subProblemBasicRow = GetBasicRow(table, branchVariableIndex); + + for (int i = 0; i < subProblemOneTable[subProblemBasicRow].Count; i++) + { + subProblemOneTable[subProblemOneTable.Count - 1][i] -= subProblemOneTable[subProblemBasicRow][i]; + subProblemTwoTable[subProblemTwoTable.Count - 1][i] += subProblemTwoTable[subProblemBasicRow][i]; + } + + Results.Add(new List>>() { subProblemOneTable }, root.Data); + Results.Add(new List>>() { subProblemTwoTable }, root.Data); + } + + private int GetBasicRow(List> table, int branchVariableIndex) + { + int basicRow = -1; + + for (int i = 1; i < table.Count; i++) + { + if (table[i][branchVariableIndex] == 1) + { + basicRow = i; + break; + } + } + + return basicRow; + } + + private int GetBranchVariable(List> table, List intBinVarIndexes) + { + if (intBinVarIndexes.Count == 1) + return intBinVarIndexes[0]; + + int branchVariableIndex = -1; + decimal smallestFractionalPart = 1; + + foreach (var intBinVar in intBinVarIndexes) + { + var rhs = (Decimal)GetRhsOfVariable(intBinVar, table); + decimal fractionalPart = rhs - Math.Truncate(rhs); + if (Math.Abs(0.5m - fractionalPart) < smallestFractionalPart) + { + smallestFractionalPart = Math.Abs(0.5m - fractionalPart); + branchVariableIndex = intBinVar; + } + } + + return branchVariableIndex; + } + + private List CanBranch(BinaryTreeNode root) + { + var intBinVarIndexes = new List(); + var indexesToDiscard = new List(); + + for (int i = 0; i < model.SignRestrictions.Count; i++) + { + if (model.SignRestrictions[i] == SignRestriction.Integer || model.SignRestrictions[i] == SignRestriction.Binary) + { + intBinVarIndexes.Add(i); + } + } + + + var table = root.Data[root.Data.Count - 1]; + + foreach (var intBinVar in intBinVarIndexes) + { + + if (!IsVariableBasic(intBinVar, table)) + { + indexesToDiscard.Add(intBinVar); + } + + else + { + double rhs = GetRhsOfVariable(intBinVar, table); + + if (rhs - Math.Truncate(rhs) < 0.00001) + { + indexesToDiscard.Add(intBinVar); + } + } + } + + intBinVarIndexes.RemoveAll(v => indexesToDiscard.Contains(v) == true); + + return intBinVarIndexes; + } + + private double GetRhsOfVariable(int intBinVar, List> table) + { + if (!IsVariableBasic(intBinVar, table)) + return 0; + + double rhs = 0; + + for (int i = 1; i < table.Count; i++) + { + if (table[i][intBinVar] == 1) + { + rhs = table[i][table[i].Count - 1]; + break; + } + } + + return rhs; + } + + private bool IsVariableBasic(int intBinVar, List> table) + { + bool isBasic = true; + + for (int i = 0; i < table.Count; i++) + { + int numberOfOnes = 0; + + if (table[i][intBinVar] == 1) + numberOfOnes++; + + if ((table[i][intBinVar] != 0 && table[i][intBinVar] != 1) || numberOfOnes > 1) + { + isBasic = false; + break; + } + } + + return isBasic; + } + } +} diff --git a/BusinessLogic/Algorithms/CuttingPlane.cs b/BusinessLogic/Algorithms/CuttingPlane.cs new file mode 100644 index 0000000..7279097 --- /dev/null +++ b/BusinessLogic/Algorithms/CuttingPlane.cs @@ -0,0 +1,203 @@ +using Common; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BusinessLogic.Algorithms +{ + public class CuttingPlane : Algorithm + { + + + private DualSimplex dualSimplex = new DualSimplex(); + + public override void PutModelInCanonicalForm(Model model) + { + dualSimplex.PutModelInCanonicalForm(model); + + dualSimplex.Solve(model); + } + + public override void Solve(Model model) + { + while (CanCut(model).Count > 0) + { + Cut(model); + dualSimplex.Solve(model); + } + } + + private void Cut(Model model) + { + var table = model.Result[model.Result.Count - 1]; + + + int cutVariableIndex = GetCutVariable(table, CanCut(model)); + + + int basicRow = GetBasicRow(table, cutVariableIndex); + + List cutConstraint = GetCutConstraint(table, basicRow); + + var newTable = ListCloner.CloneList(table); + + newTable.Add(cutConstraint); + + + for (int i = 0; i < newTable.Count; i++) + { + if (i == newTable.Count - 1) + { + newTable[i].Insert(newTable[i].Count - 1, 1); + } + else + { + newTable[i].Insert(newTable[i].Count - 1, 0); + } + } + + model.Result.Add(newTable); + } + + private List GetCutConstraint(List> table, int basicRow) + { + List cutConstraint = new List(); + + for (int i = 0; i < table[basicRow].Count; i++) + { + + if (table[basicRow][i] == Math.Truncate(table[basicRow][i])) + { + cutConstraint.Add(0); + } + else + { + + double fractionalPart = Math.Abs(Math.Floor(table[basicRow][i]) - table[basicRow][i]); + cutConstraint.Add(-1 * fractionalPart); + } + } + + return cutConstraint; + } + + private List CanCut(Model model) + { + List intBinVarIndexes = new List(); + List indexesToDiscard = new List(); + var lastTable = model.Result[model.Result.Count - 1]; + + for (int i = 0; i < model.SignRestrictions.Count; i++) + { + if (model.SignRestrictions[i] == SignRestriction.Integer || model.SignRestrictions[i] == SignRestriction.Binary) + { + intBinVarIndexes.Add(i); + } + } + + + foreach (var intBinVar in intBinVarIndexes) + { + + if (!IsVariableBasic(intBinVar, lastTable)) + { + indexesToDiscard.Add(intBinVar); + } + + else + { + double rhs = GetRhsOfVariable(intBinVar, lastTable); + + if (rhs - Math.Truncate(rhs) < 0.00001) + { + indexesToDiscard.Add(intBinVar); + } + } + } + + intBinVarIndexes.RemoveAll(v => indexesToDiscard.Contains(v) == true); + + return intBinVarIndexes; + } + + private double GetRhsOfVariable(int intBinVar, List> table) + { + if (!IsVariableBasic(intBinVar, table)) + return 0; + + double rhs = 0; + + for (int i = 1; i < table.Count; i++) + { + if (table[i][intBinVar] == 1) + { + rhs = table[i][table[i].Count - 1]; + break; + } + } + + return rhs; + } + + private bool IsVariableBasic(int intBinVar, List> table) + { + bool isBasic = true; + + for (int i = 0; i < table.Count; i++) + { + int numberOfOnes = 0; + + if (table[i][intBinVar] == 1) + numberOfOnes++; + + if ((table[i][intBinVar] != 0 && table[i][intBinVar] != 1) || numberOfOnes > 1) + { + isBasic = false; + break; + } + } + + return isBasic; + } + + private int GetCutVariable(List> table, List intBinVarIndexes) + { + if (intBinVarIndexes.Count == 1) + return intBinVarIndexes[0]; + + int branchVariableIndex = -1; + decimal smallestFractionalPart = 1; + + foreach (var intBinVar in intBinVarIndexes) + { + var rhs = (Decimal)GetRhsOfVariable(intBinVar, table); + decimal fractionalPart = rhs - Math.Truncate(rhs); + if (Math.Abs(0.5m - fractionalPart) < smallestFractionalPart) + { + smallestFractionalPart = Math.Abs(0.5m - fractionalPart); + branchVariableIndex = intBinVar; + } + } + + return branchVariableIndex; + } + + private int GetBasicRow(List> table, int variableIndex) + { + int basicRow = -1; + + for (int i = 1; i < table.Count; i++) + { + if (table[i][variableIndex] == 1) + { + basicRow = i; + break; + } + } + + return basicRow; + } + } +} diff --git a/BusinessLogic/Algorithms/DualSimplex.cs b/BusinessLogic/Algorithms/DualSimplex.cs new file mode 100644 index 0000000..81b5d6c --- /dev/null +++ b/BusinessLogic/Algorithms/DualSimplex.cs @@ -0,0 +1,223 @@ +using Common; +using Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BusinessLogic.Algorithms +{ + public class DualSimplex : Algorithm + { + public override void PutModelInCanonicalForm(Model model) + { + + List> tableZero = new List>(); + + tableZero.Add(new List()); + + foreach (var decVar in model.ObjectiveFunction.DecisionVariables) + { + tableZero[0].Add(decVar.Coefficient * -1); + } + + + for (int i = 0; i < model.Constraints.Count; i++) + { + tableZero[0].Add(0); + if (model.Constraints[i].InequalitySign == InequalitySign.EqualTo) + tableZero[0].Add(0); + } + + tableZero[0].Add(0); + + var equalsConstraints = model.Constraints.Where(c => c.InequalitySign == InequalitySign.EqualTo).ToList(); + if (equalsConstraints?.Count() > 0) + { + for (int i = 0; i < equalsConstraints.Count(); i++) + { + model.Constraints[model.Constraints.FindIndex(c => c == equalsConstraints[i])].InequalitySign = InequalitySign.LessThanOrEqualTo; + var newConstraint = new Constraint(); + newConstraint.InequalitySign = InequalitySign.GreaterThanOrEqualTo; + newConstraint.RightHandSide = equalsConstraints[i].RightHandSide; + + foreach (var decVar in equalsConstraints[i].DecisionVariables) + { + newConstraint.DecisionVariables.Add(new DecisionVariable() { Coefficient = decVar.Coefficient }); + } + + model.Constraints.Add(newConstraint); + } + } + + for (int i = 0; i < model.Constraints.Count; i++) + { + List constraintValues = new List(); + + + foreach (var decVar in model.Constraints[i].DecisionVariables) + { + if (model.Constraints[i].InequalitySign == InequalitySign.LessThanOrEqualTo) + { + constraintValues.Add(decVar.Coefficient); + } + else + { + constraintValues.Add(decVar.Coefficient * -1); + } + } + + for (int j = 0; j < model.Constraints.Count; j++) + { + if (j == i) + { + constraintValues.Add(1); + } + else + { + constraintValues.Add(0); + } + } + + if (model.Constraints[i].InequalitySign == InequalitySign.LessThanOrEqualTo) + { + constraintValues.Add(model.Constraints[i].RightHandSide); + } + else + { + constraintValues.Add(model.Constraints[i].RightHandSide * -1); + } + + tableZero.Add(constraintValues); + } + + model.Result.Add(tableZero); + } + + public override void Solve(Model model) + { + Iterate(model); + var primalSimplex = new PrimalSimplex(); + primalSimplex.Solve(model); + } + + private void Iterate(Model model) + { + + if (!CanPivot(model)) + return; + + + int pivotRow = GetPivotRow(model); + + int pivotColumn = GetPivotColumn(model, pivotRow); + + if (pivotColumn == -1) + throw new InfeasibleException("There is no suitable column to pivot on - the problem is infeasible"); + + Pivot(model, pivotRow, pivotColumn); + + + Iterate(model); + } + + private bool CanPivot(Model model) + { + + bool canPivot = false; + var table = model.Result[model.Result.Count - 1]; + + for (int i = 1; i < table.Count; i++) + { + + if (table[i][table[i].Count - 1] < -0.000000000001) + { + canPivot = true; + break; + } + } + + return canPivot; + } + + private int GetPivotRow(Model model) + { + int pivotRow = -1; + var table = model.Result[model.Result.Count - 1]; + double mostNegative = 0; + + for (int i = 1; i < table.Count; i++) + { + if (table[i][table[i].Count - 1] < 0 && table[i][table[i].Count - 1] < mostNegative) + { + mostNegative = table[i][table[i].Count - 1]; + pivotRow = i; + } + } + + return pivotRow; + } + + private int GetPivotColumn(Model model, int pivotRow) + { + int pivotColumn = -1; + var table = model.Result[model.Result.Count - 1]; + + double lowestRatio = double.MaxValue; + for (int i = 0; i < table[0].Count - 1; i++) + { + if (table[pivotRow][i] < 0) + { + double ratio = Math.Abs(table[0][i] / table[pivotRow][i]); + if (ratio < lowestRatio) + { + lowestRatio = ratio; + pivotColumn = i; + } + } + } + + return pivotColumn; + } + + private void Pivot(Model model, int pivotRow, int pivotColumn) + { + var previousTable = model.Result[model.Result.Count - 1]; + var newTable = new List>(); + + for (int i = 0; i < previousTable.Count; i++) + { + newTable.Add(new List()); + + for (int j = 0; j < previousTable[i].Count; j++) + { + newTable[i].Add(previousTable[i][j]); + } + } + + + double factor = 1 / newTable[pivotRow][pivotColumn]; + for (int i = 0; i < newTable[pivotRow].Count; i++) + { + newTable[pivotRow][i] *= factor; + } + + double pivotColumnValue; + for (int i = 0; i < newTable.Count; i++) + { + pivotColumnValue = newTable[i][pivotColumn]; + + if (i != pivotRow && pivotColumnValue != 0) + { + for (int j = 0; j < newTable[i].Count; j++) + { + newTable[i][j] += (-1 * pivotColumnValue * newTable[pivotRow][j]); + } + } + } + + model.Result.Add(newTable); + } + } +} diff --git a/BusinessLogic/Algorithms/PrimalSimplex.cs b/BusinessLogic/Algorithms/PrimalSimplex.cs new file mode 100644 index 0000000..aa2557a --- /dev/null +++ b/BusinessLogic/Algorithms/PrimalSimplex.cs @@ -0,0 +1,212 @@ +using Common; +using Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BusinessLogic.Algorithms +{ + public class PrimalSimplex : Algorithm + { + public override void PutModelInCanonicalForm(Model model) + { + + List> tableZero = new List>(); + + + tableZero.Add(new List()); + + foreach (var decVar in model.ObjectiveFunction.DecisionVariables) + { + tableZero[0].Add(decVar.Coefficient * -1); + } + + + for (int i = 0; i <= model.Constraints.Count; i++) + { + tableZero[0].Add(0); + } + + for (int i = 0; i < model.Constraints.Count; i++) + { + List constraintValues = new List(); + + foreach (var decVar in model.Constraints[i].DecisionVariables) + { + constraintValues.Add(decVar.Coefficient); + } + + for (int j = 0; j < model.Constraints.Count; j++) + { + if (j == i) + { + constraintValues.Add(1); + } + else + { + constraintValues.Add(0); + } + } + + constraintValues.Add(model.Constraints[i].RightHandSide); + + tableZero.Add(constraintValues); + } + + model.Result.Add(tableZero); + } + + public override void Solve(Model model) + { + Iterate(model); + } + + private bool IsOptimal(Model model) + { + bool isOptimal = true; + var table = model.Result[model.Result.Count - 1]; + + if (model.ProblemType == ProblemType.Maximization) + { + for (int i = 0; i < table[0].Count - 1; i++) + { + if (table[0][i] < 0) + { + isOptimal = false; + break; + } + } + } + else + { + for (int i = 0; i < table[0].Count - 1; i++) + { + if (table[0][i] > 0) + { + isOptimal = false; + break; + } + } + } + + return isOptimal; + } + + private void Iterate(Model model) + { + + if (IsOptimal(model)) + return; + + + int pivotColumn = GetPivotColumn(model); + // Then get the pivot row + int pivotRow = GetPivotRow(model, pivotColumn); + + if (pivotRow == -1) + throw new InfeasibleException("There is no suitable row to pivot on - the problem is infeasible"); + + Pivot(model, pivotRow, pivotColumn); + + Iterate(model); + } + + private void Pivot(Model model, int pivotRow, int pivotColumn) + { + var previousTable = model.Result[model.Result.Count - 1]; + var newTable = new List>(); + + for (int i = 0; i < previousTable.Count; i++) + { + newTable.Add(new List()); + + for (int j = 0; j < previousTable[i].Count; j++) + { + newTable[i].Add(previousTable[i][j]); + } + } + + + double factor = 1 / newTable[pivotRow][pivotColumn]; + for (int i = 0; i < newTable[pivotRow].Count; i++) + { + newTable[pivotRow][i] *= factor; + } + + double pivotColumnValue; + for (int i = 0; i < newTable.Count; i++) + { + pivotColumnValue = newTable[i][pivotColumn]; + + if (i != pivotRow && pivotColumnValue != 0) + { + for (int j = 0; j < newTable[i].Count; j++) + { + newTable[i][j] += (-1 * pivotColumnValue * newTable[pivotRow][j]); + } + } + } + + model.Result.Add(newTable); + } + + private int GetPivotColumn(Model model) + { + int colIndex = -1; + var table = model.Result[model.Result.Count - 1]; + + if (model.ProblemType == ProblemType.Maximization) + { + double mostNegative = 0; + + for (int i = 0; i < table[0].Count - 1; i++) + { + if (table[0][i] < 0 && table[0][i] < mostNegative) + { + mostNegative = table[0][i]; + colIndex = i; + } + } + } + else + { + double mostPositive = 0; + + for (int i = 0; i < table[0].Count - 1; i++) + { + if (table[0][i] > 0 && table[0][i] > mostPositive) + { + mostPositive = table[0][i]; + colIndex = i; + } + } + } + + return colIndex; + } + + private int GetPivotRow(Model model, int pivotColumn) + { + int rowIndex = -1; + var table = model.Result[model.Result.Count - 1]; + + double lowestRatio = double.MaxValue; + for (int i = 1; i < table.Count; i++) + { + if (table[i][pivotColumn] > 0) + { + double ratio = table[i][table[i].Count - 1] / table[i][pivotColumn]; + if (ratio < lowestRatio && ratio >= 0) + { + lowestRatio = ratio; + rowIndex = i; + } + } + } + + return rowIndex; + } + } +} diff --git a/BusinessLogic/Algorithms/TwoPhaseSimplex.cs b/BusinessLogic/Algorithms/TwoPhaseSimplex.cs new file mode 100644 index 0000000..5e2554a --- /dev/null +++ b/BusinessLogic/Algorithms/TwoPhaseSimplex.cs @@ -0,0 +1,346 @@ +using Common; +using Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BusinessLogic.Algorithms +{ + public class TwoPhaseSimplex : Algorithm + { + private int numberOfArtificialVars = 0; + + public override void PutModelInCanonicalForm(Model model) + { + + for (int i = 0; i < model.Constraints.Count; i++) + { + if (model.Constraints[i].RightHandSide < 0) + { + for (int j = 0; j < model.Constraints[i].DecisionVariables.Count; j++) + { + model.Constraints[i].DecisionVariables[j].Coefficient *= -1; + } + + model.Constraints[i].RightHandSide *= -1; + + if (model.Constraints[i].InequalitySign == InequalitySign.LessThanOrEqualTo) + { + model.Constraints[i].InequalitySign = InequalitySign.GreaterThanOrEqualTo; + } + else if (model.Constraints[i].InequalitySign == InequalitySign.GreaterThanOrEqualTo) + { + model.Constraints[i].InequalitySign = InequalitySign.LessThanOrEqualTo; + } + } + } + + + List> tableZero = new List>(); + + + tableZero.Add(new List()); + + foreach (var decVar in model.ObjectiveFunction.DecisionVariables) + { + tableZero[0].Add(decVar.Coefficient * -1); + } + + foreach (var constraint in model.Constraints) + { + if (constraint.InequalitySign == InequalitySign.LessThanOrEqualTo || + constraint.InequalitySign == InequalitySign.GreaterThanOrEqualTo) + { + tableZero[0].Add(0); + } + + if (constraint.InequalitySign == InequalitySign.EqualTo || + constraint.InequalitySign == InequalitySign.GreaterThanOrEqualTo) + { + tableZero[0].Add(0); + } + } + + tableZero[0].Add(0); + + for (int i = 0; i < model.Constraints.Count; i++) + { + List constraintValues = new List(); + + foreach (var decVar in model.Constraints[i].DecisionVariables) + { + constraintValues.Add(decVar.Coefficient); + } + + for (int j = 0; j < model.Constraints.Count; j++) + { + if (model.Constraints[j].InequalitySign == InequalitySign.LessThanOrEqualTo) + { + if (j == i) + { + constraintValues.Add(1); + } + else + { + constraintValues.Add(0); + } + } + else if (model.Constraints[j].InequalitySign == InequalitySign.GreaterThanOrEqualTo) + { + if (j == i) + { + constraintValues.Add(-1); + } + else + { + constraintValues.Add(0); + } + } + } + + constraintValues.Add(model.Constraints[i].RightHandSide); + + for (int j = 0; j < model.Constraints.Count; j++) + { + if (model.Constraints[j].InequalitySign == InequalitySign.EqualTo || + model.Constraints[j].InequalitySign == InequalitySign.GreaterThanOrEqualTo) + { + if (j == i) + { + constraintValues.Insert(constraintValues.Count - 1, 1); + } + else + { + constraintValues.Insert(constraintValues.Count - 1, 0); + } + } + } + + tableZero.Add(constraintValues); + } + + numberOfArtificialVars = model.Constraints.Where(c => c.InequalitySign == + InequalitySign.EqualTo || c.InequalitySign == InequalitySign.GreaterThanOrEqualTo).Count(); + + List wRow = new List(); + for (int i = 0; i < tableZero[0].Count; i++) + { + wRow.Add(0); + } + + for (int i = 1; i < tableZero.Count; i++) + { + if (model.Constraints[i - 1].InequalitySign == InequalitySign.EqualTo || + model.Constraints[i - 1].InequalitySign == InequalitySign.GreaterThanOrEqualTo) + { + for (int j = 0; j < (tableZero[i].Count - numberOfArtificialVars - 1); j++) + { + wRow[j] += tableZero[i][j]; + } + + wRow[wRow.Count - 1] += tableZero[i][tableZero[i].Count - 1]; + } + } + + tableZero.Insert(0, wRow); + model.Result.Add(tableZero); + } + + public override void Solve(Model model) + { + Iterate(model); + var lastTable = model.Result[model.Result.Count - 1]; + + if (lastTable[0][lastTable[0].Count - 1] > 0) + { + throw new InfeasibleException("The problem is infeasible"); + } + + bool allArtificialsNonBasic = true; + for (int i = lastTable[0].Count - (numberOfArtificialVars + 1); i < lastTable[0].Count - 1; i++) + { + if (IsVariableBasic(i, lastTable)) + { + allArtificialsNonBasic = false; + break; + } + } + + if (allArtificialsNonBasic) + { + lastTable.RemoveAt(0); + + for (int i = 0; i < lastTable.Count; i++) + { + for (int j = 0; j < numberOfArtificialVars; j++) + { + lastTable[i].RemoveAt(lastTable[i].Count - 2); + } + } + } + else + { + for (int i = 0; i < model.ObjectiveFunction.DecisionVariables.Count; i++) + { + if (lastTable[0][i] < 0) + { + for (int j = 0; j < lastTable.Count; j++) + { + lastTable[j].RemoveAt(i); + } + } + } + + for (int i = lastTable[0].Count - (numberOfArtificialVars + 1); i < lastTable[0].Count - 1; i++) + { + if (!IsVariableBasic(i, lastTable)) + { + for (int j = 0; j < lastTable.Count; j++) + { + lastTable[j].RemoveAt(i); + } + } + } + + lastTable.RemoveAt(0); + } + + var primalSimplex = new PrimalSimplex(); + primalSimplex.Solve(model); + } + + private bool IsOptimal(Model model) + { + bool isOptimal = true; + var table = model.Result[model.Result.Count - 1]; + + for (int i = 0; i < table[0].Count - 1; i++) + { + if (table[0][i] > 0) + { + isOptimal = false; + break; + } + } + + return isOptimal; + } + + private void Iterate(Model model) + { + if (IsOptimal(model)) + return; + + int pivotColumn = GetPivotColumn(model); + int pivotRow = GetPivotRow(model, pivotColumn); + + if (pivotRow == -1) + throw new InfeasibleException("There is no suitable row to pivot on - the problem is infeasible"); + + Pivot(model, pivotRow, pivotColumn); + + Iterate(model); + } + + private void Pivot(Model model, int pivotRow, int pivotColumn) + { + var previousTable = model.Result[model.Result.Count - 1]; + var newTable = new List>(); + + for (int i = 0; i < previousTable.Count; i++) + { + newTable.Add(new List()); + + for (int j = 0; j < previousTable[i].Count; j++) + { + newTable[i].Add(previousTable[i][j]); + } + } + + double factor = 1 / newTable[pivotRow][pivotColumn]; + for (int i = 0; i < newTable[pivotRow].Count; i++) + { + newTable[pivotRow][i] *= factor; + } + + double pivotColumnValue; + for (int i = 0; i < newTable.Count; i++) + { + pivotColumnValue = newTable[i][pivotColumn]; + + if (i != pivotRow && pivotColumnValue != 0) + { + for (int j = 0; j < newTable[i].Count; j++) + { + newTable[i][j] += (-1 * pivotColumnValue * newTable[pivotRow][j]); + } + } + } + + model.Result.Add(newTable); + } + + private int GetPivotColumn(Model model) + { + int colIndex = -1; + var table = model.Result[model.Result.Count - 1]; + double mostPositive = 0; + + for (int i = 0; i < table[0].Count - 1; i++) + { + if (table[0][i] > 0 && table[0][i] > mostPositive) + { + mostPositive = table[0][i]; + colIndex = i; + } + } + + return colIndex; + } + + private int GetPivotRow(Model model, int pivotColumn) + { + int rowIndex = -1; + var table = model.Result[model.Result.Count - 1]; + + double lowestRatio = double.MaxValue; + for (int i = 1; i < table.Count; i++) + { + if (table[i][pivotColumn] > 0) + { + double ratio = table[i][table[i].Count - 1] / table[i][pivotColumn]; + if (ratio < lowestRatio && ratio >= 0) + { + lowestRatio = ratio; + rowIndex = i; + } + } + } + + return rowIndex; + } + + private bool IsVariableBasic(int index, List> table) + { + bool isBasic = true; + + for (int i = 0; i < table.Count; i++) + { + int numberOfOnes = 0; + + if (table[i][index] == 1) + numberOfOnes++; + + if ((table[i][index] != 0 && table[i][index] != 1) || numberOfOnes > 1) + { + isBasic = false; + break; + } + } + + return isBasic; + } + } +} diff --git a/BusinessLogic/BinaryTree.cs b/BusinessLogic/BinaryTree.cs new file mode 100644 index 0000000..e3f1bca --- /dev/null +++ b/BusinessLogic/BinaryTree.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BusinessLogic +{ + public class BinaryTree + { + public BinaryTreeNode Root { get; set; } + + public void Add(List>> subProblem, List>> parentProblem = null) + { + BinaryTreeNode newNode = new BinaryTreeNode(); + newNode.Data = subProblem; + + if (Root == null) + { + Root = newNode; + return; + } + + if (parentProblem != null) + { + BinaryTreeNode parentNode = Find(parentProblem); + if (parentNode != null && parentNode.LeftNode == null) + { + parentNode.LeftNode = newNode; + return; + } + + if (parentNode != null && parentNode.RightNode == null) + { + parentNode.RightNode = newNode; + } + } + } + + public BinaryTreeNode Find(List>> subProblem) + { + return this.Find(subProblem, this.Root); + } + + private BinaryTreeNode Find(List>> subProblem, BinaryTreeNode parent) + { + if (parent == null) + return null; + + if (parent.Data == subProblem) + { + return parent; + } + + return Find(subProblem, parent.LeftNode) == null ? Find(subProblem, parent.RightNode) : Find(subProblem, parent.LeftNode); + } + + public int GetHeight(BinaryTreeNode root) + { + if (root == null) + return 0; + + int leftHeight = GetHeight(root.LeftNode); + int rightHeight = GetHeight(root.RightNode); + + return leftHeight > rightHeight ? leftHeight + 1 : rightHeight + 1; + } + } +} diff --git a/BusinessLogic/BinaryTreeNode.cs b/BusinessLogic/BinaryTreeNode.cs new file mode 100644 index 0000000..13d4902 --- /dev/null +++ b/BusinessLogic/BinaryTreeNode.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BusinessLogic +{ + public class BinaryTreeNode + { + public BinaryTreeNode LeftNode { get; set; } + public BinaryTreeNode RightNode { get; set; } + public List>> Data { get; set; } + } +} diff --git a/BusinessLogic/BusinessLogic.csproj b/BusinessLogic/BusinessLogic.csproj new file mode 100644 index 0000000..5ca3220 --- /dev/null +++ b/BusinessLogic/BusinessLogic.csproj @@ -0,0 +1,67 @@ + + + + + Debug + AnyCPU + {F904DA9B-8BA5-4803-88C1-24A6471C7FEF} + Library + Properties + BusinessLogic + BusinessLogic + v4.8 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + {02E85643-5DA8-4A1E-AF07-10184FC132A0} + DataAccess + + + {04C11623-F02E-45C6-8C51-82244CFF4780} + Common + + + + \ No newline at end of file diff --git a/BusinessLogic/ListCloner.cs b/BusinessLogic/ListCloner.cs new file mode 100644 index 0000000..06d376b --- /dev/null +++ b/BusinessLogic/ListCloner.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BusinessLogic +{ + public class ListCloner + { + public static List>> CloneList(List>> oldList) + { + List>> newList = new List>>(); + + int iterationCount = oldList.Count; + int rowCount = oldList[0].Count; + int colCount = oldList[0][0].Count; + + for (int i = 0; i < iterationCount; i++) + { + var table = new List>(); + for (int j = 0; j < rowCount; j++) + { + var row = new List(); + for (int k = 0; k < colCount; k++) + { + row.Add(oldList[i][j][k]); + } + table.Add(row); + } + newList.Add(table); + } + + return newList; + } + + public static List> CloneList(List> oldList) + { + List> newList = new List>(); + + int rowCount = oldList.Count; + int colCount = oldList[0].Count; + + for (int i = 0; i < rowCount; i++) + { + var newRow = new List(); + for (int j = 0; j < colCount; j++) + { + newRow.Add(oldList[i][j]); + } + newList.Add(newRow); + } + + return newList; + } + } +} diff --git a/BusinessLogic/ModelSolver.cs b/BusinessLogic/ModelSolver.cs new file mode 100644 index 0000000..e344a41 --- /dev/null +++ b/BusinessLogic/ModelSolver.cs @@ -0,0 +1,25 @@ +using BusinessLogic.Algorithms; +using Common; +using DataAccess; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BusinessLogic +{ + public class ModelSolver + { + public static void Solve(Model model, Algorithm algorithm) + { + algorithm.PutModelInCanonicalForm(model); + + algorithm.Solve(model); + + Console.Clear(); + Console.WriteLine("Here is the solution:"); + Console.WriteLine("========================================================================================================="); + } + } +} diff --git a/BusinessLogic/Properties/AssemblyInfo.cs b/BusinessLogic/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a982168 --- /dev/null +++ b/BusinessLogic/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("BusinessLogic")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("BusinessLogic")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f904da9b-8ba5-4803-88c1-24a6471c7fef")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DataAccess/DataAccess.csproj b/DataAccess/DataAccess.csproj new file mode 100644 index 0000000..3b0e68d --- /dev/null +++ b/DataAccess/DataAccess.csproj @@ -0,0 +1,77 @@ + + + + + Debug + AnyCPU + {02E85643-5DA8-4A1E-AF07-10184FC132A0} + Library + Properties + DataAccess + DataAccess + v4.8 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + {04C11623-F02E-45C6-8C51-82244CFF4780} + Common + + + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + + \ No newline at end of file diff --git a/DataAccess/ModelReader.cs b/DataAccess/ModelReader.cs new file mode 100644 index 0000000..4287b16 --- /dev/null +++ b/DataAccess/ModelReader.cs @@ -0,0 +1,164 @@ +using Common; +using Models; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataAccess +{ + public class ModelReader + { + public static Model ReadModelFromFile(string path) + { + List lines = new List(); + + try + { + using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read)) + { + using (StreamReader reader = new StreamReader(fileStream)) + { + while (!reader.EndOfStream) + { + lines.Add(reader.ReadLine()); + } + } + } + + return ConvertToModel(lines); + } + catch (FileNotFoundException) + { + throw new CustomException("Could not find the specified file"); + } + catch (DirectoryNotFoundException) + { + throw new CustomException("Could not find the specified directory"); + } + catch (ArgumentException) + { + throw new CustomException("The specified path was invalid"); + } + catch (IOException) + { + throw new CustomException("There was an error reading the specified file"); + } + } + + private static Model ConvertToModel(List lines) + { + Model model = new Model(); + + try + { + if (lines.Count < 1) + { + throw new CustomException("The specified file is empty"); + } + + string[] objectiveFunction = lines[0].Split(' '); + + if (!(objectiveFunction[0].ToLower().Equals("max") || objectiveFunction[0].ToLower().Equals("min"))) + { + throw new CustomException("The given problem does not specify whether to maximize or minimize the objective function"); + } + + model.ProblemType = objectiveFunction[0].ToLower().Equals("max") ? ProblemType.Maximization : ProblemType.Minimization; + + for (int i = 1; i < objectiveFunction.Length; i++) + { + model.ObjectiveFunction.DecisionVariables.Add(new DecisionVariable() { Coefficient = double.Parse(objectiveFunction[i]) }); + } + + if (lines.Count < 2) + { + throw new CustomException("The given problem does not contain any constraints"); + } + + for (int i = 1; i < lines.Count - 1; i++) + { + string[] constraintArr = lines[i].Split(' '); + Constraint constraint = new Constraint(); + + for (int j = 0; j < constraintArr.Length - 2; j++) + { + constraint.DecisionVariables.Add(new DecisionVariable() { Coefficient = double.Parse(constraintArr[j]) }); + } + + switch (constraintArr[constraintArr.Length - 2]) + { + case "=": + { + constraint.InequalitySign = InequalitySign.EqualTo; + } + break; + case "<=": + { + constraint.InequalitySign = InequalitySign.LessThanOrEqualTo; + } + break; + case ">=": + { + constraint.InequalitySign = InequalitySign.GreaterThanOrEqualTo; + } + break; + default: + { + throw new CustomException($"Constraint {model.Constraints.Count + 1} does not have a valid inequality symbol"); + } + } + + constraint.RightHandSide = double.Parse(constraintArr[constraintArr.Length - 1]); + model.Constraints.Add(constraint); + } + + string[] signRestrictions = lines[lines.Count - 1].Split(' '); + + foreach (var restriction in signRestrictions) + { + switch (restriction.ToLower()) + { + case "+": + { + model.SignRestrictions.Add(SignRestriction.Positive); + } + break; + case "-": + { + model.SignRestrictions.Add(SignRestriction.Negative); + } + break; + case "urs": + { + model.SignRestrictions.Add(SignRestriction.Unrestricted); + } + break; + case "int": + { + model.SignRestrictions.Add(SignRestriction.Integer); + } + break; + case "bin": + { + model.SignRestrictions.Add(SignRestriction.Binary); + } + break; + default: + { + throw new CustomException("Invalid sign restriction found"); + } + } + } + } + catch (FormatException) + { + throw new CustomException("One of the decision variables has an invalid coefficient"); + } + + return model; + } + } +} diff --git a/DataAccess/Properties/AssemblyInfo.cs b/DataAccess/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..80d6369 --- /dev/null +++ b/DataAccess/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("DataAccess")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("DataAccess")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("02e85643-5da8-4a1e-af07-10184fc132a0")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DataAccess/acme.txt b/DataAccess/acme.txt new file mode 100644 index 0000000..552fb3d --- /dev/null +++ b/DataAccess/acme.txt @@ -0,0 +1,5 @@ +min +4 +1 ++3 +1 >= 10 ++1 +1 >= 5 ++1 +0 >= 3 ++ + \ No newline at end of file diff --git a/DataAccess/branch.txt b/DataAccess/branch.txt new file mode 100644 index 0000000..1517c6c --- /dev/null +++ b/DataAccess/branch.txt @@ -0,0 +1,4 @@ +max +8 +5 ++1 +1 <= +6 ++9 +5 <= +45 +int int \ No newline at end of file diff --git a/DataAccess/cut.txt b/DataAccess/cut.txt new file mode 100644 index 0000000..c9c81d5 --- /dev/null +++ b/DataAccess/cut.txt @@ -0,0 +1,4 @@ +min +6 +8 ++3 +1 >= 4 ++1 +2 >= 4 +int int \ No newline at end of file diff --git a/DataAccess/farmer.txt b/DataAccess/farmer.txt new file mode 100644 index 0000000..aaa9688 --- /dev/null +++ b/DataAccess/farmer.txt @@ -0,0 +1,5 @@ +max +100 +30 ++1 +1 <= +7 ++10 +4 <= 40 ++0 +1 >= 3 ++ + \ No newline at end of file diff --git a/DataAccess/korean.txt b/DataAccess/korean.txt new file mode 100644 index 0000000..b10dbaa --- /dev/null +++ b/DataAccess/korean.txt @@ -0,0 +1,4 @@ +min +50 +100 ++7 +2 >= +28 ++2 +12 >= +24 ++ + \ No newline at end of file diff --git a/DataAccess/limpopo.txt b/DataAccess/limpopo.txt new file mode 100644 index 0000000..1fe38d5 --- /dev/null +++ b/DataAccess/limpopo.txt @@ -0,0 +1,6 @@ +max +60 +30 +20 ++8 +6 +1 <= +48 ++4 +2 +1,5 <= +20 ++2 +1,5 +0,5 <= +8 ++0 +1 +0 <= +5 ++ + + \ No newline at end of file diff --git a/DataAccess/santa.txt b/DataAccess/santa.txt new file mode 100644 index 0000000..e36d1b6 --- /dev/null +++ b/DataAccess/santa.txt @@ -0,0 +1,5 @@ +max +3 +2 ++2 +1 <= 100 ++1 +1 <= 80 ++1 +0 <= 40 ++ + \ No newline at end of file diff --git a/LPR381_Project.sln b/LPR381_Project.sln new file mode 100644 index 0000000..255cf66 --- /dev/null +++ b/LPR381_Project.sln @@ -0,0 +1,49 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31624.102 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Solve", "LPR381_Project\Solve.csproj", "{00C7750A-2297-460E-AABD-2AC53FFD1F17}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BusinessLogic", "BusinessLogic\BusinessLogic.csproj", "{F904DA9B-8BA5-4803-88C1-24A6471C7FEF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Presentation", "Presentation\Presentation.csproj", "{377D38FE-AA9D-4AB0-B743-9E80AA0C82C4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataAccess", "DataAccess\DataAccess.csproj", "{02E85643-5DA8-4A1E-AF07-10184FC132A0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "Models\Common.csproj", "{04C11623-F02E-45C6-8C51-82244CFF4780}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {00C7750A-2297-460E-AABD-2AC53FFD1F17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {00C7750A-2297-460E-AABD-2AC53FFD1F17}.Debug|Any CPU.Build.0 = Debug|Any CPU + {00C7750A-2297-460E-AABD-2AC53FFD1F17}.Release|Any CPU.ActiveCfg = Release|Any CPU + {00C7750A-2297-460E-AABD-2AC53FFD1F17}.Release|Any CPU.Build.0 = Release|Any CPU + {F904DA9B-8BA5-4803-88C1-24A6471C7FEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F904DA9B-8BA5-4803-88C1-24A6471C7FEF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F904DA9B-8BA5-4803-88C1-24A6471C7FEF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F904DA9B-8BA5-4803-88C1-24A6471C7FEF}.Release|Any CPU.Build.0 = Release|Any CPU + {377D38FE-AA9D-4AB0-B743-9E80AA0C82C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {377D38FE-AA9D-4AB0-B743-9E80AA0C82C4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {377D38FE-AA9D-4AB0-B743-9E80AA0C82C4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {377D38FE-AA9D-4AB0-B743-9E80AA0C82C4}.Release|Any CPU.Build.0 = Release|Any CPU + {02E85643-5DA8-4A1E-AF07-10184FC132A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {02E85643-5DA8-4A1E-AF07-10184FC132A0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {02E85643-5DA8-4A1E-AF07-10184FC132A0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {02E85643-5DA8-4A1E-AF07-10184FC132A0}.Release|Any CPU.Build.0 = Release|Any CPU + {04C11623-F02E-45C6-8C51-82244CFF4780}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04C11623-F02E-45C6-8C51-82244CFF4780}.Debug|Any CPU.Build.0 = Debug|Any CPU + {04C11623-F02E-45C6-8C51-82244CFF4780}.Release|Any CPU.ActiveCfg = Release|Any CPU + {04C11623-F02E-45C6-8C51-82244CFF4780}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9EF1E2C9-7C61-4DE5-8087-F1E388B2B976} + EndGlobalSection +EndGlobal diff --git a/LPR381_Project/App.config b/LPR381_Project/App.config new file mode 100644 index 0000000..193aecc --- /dev/null +++ b/LPR381_Project/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/LPR381_Project/Program.cs b/LPR381_Project/Program.cs new file mode 100644 index 0000000..e739944 --- /dev/null +++ b/LPR381_Project/Program.cs @@ -0,0 +1,20 @@ +using DataAccess; +using Models; +using Presentation; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LPR381_Project +{ + class Program + { + static void Main(string[] args) + { + MainMenu.Run(); + Console.ReadKey(); + } + } +} diff --git a/LPR381_Project/Properties/AssemblyInfo.cs b/LPR381_Project/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7708e83 --- /dev/null +++ b/LPR381_Project/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("LPR381_Project")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("LPR381_Project")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("00c7750a-2297-460e-aabd-2ac53ffd1f17")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/LPR381_Project/Solve.csproj b/LPR381_Project/Solve.csproj new file mode 100644 index 0000000..813a2f3 --- /dev/null +++ b/LPR381_Project/Solve.csproj @@ -0,0 +1,67 @@ + + + + + Debug + AnyCPU + {00C7750A-2297-460E-AABD-2AC53FFD1F17} + Exe + LPR381_Project + LPR381_Project + v4.8 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + {02E85643-5DA8-4A1E-AF07-10184FC132A0} + DataAccess + + + {04C11623-F02E-45C6-8C51-82244CFF4780} + Common + + + {377D38FE-AA9D-4AB0-B743-9E80AA0C82C4} + Presentation + + + + \ No newline at end of file diff --git a/Models/Common.csproj b/Models/Common.csproj new file mode 100644 index 0000000..1625f14 --- /dev/null +++ b/Models/Common.csproj @@ -0,0 +1,56 @@ + + + + + Debug + AnyCPU + {04C11623-F02E-45C6-8C51-82244CFF4780} + Library + Properties + Models + Models + v4.8 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Models/Constraint.cs b/Models/Constraint.cs new file mode 100644 index 0000000..9069212 --- /dev/null +++ b/Models/Constraint.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Common +{ + public class Constraint + { + public List DecisionVariables { get; set; } = new List(); + public InequalitySign InequalitySign { get; set; } + public double RightHandSide { get; set; } + } +} diff --git a/Models/CustomException.cs b/Models/CustomException.cs new file mode 100644 index 0000000..10d957b --- /dev/null +++ b/Models/CustomException.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Models +{ + + [Serializable] + public class CustomException : Exception + { + public CustomException() { } + public CustomException(string message) : base(message) { } + public CustomException(string message, Exception inner) : base(message, inner) { } + protected CustomException( + System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) : base(info, context) { } + } +} diff --git a/Models/DecisionVariable.cs b/Models/DecisionVariable.cs new file mode 100644 index 0000000..9eab4b1 --- /dev/null +++ b/Models/DecisionVariable.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Common +{ + public class DecisionVariable + { + public double Coefficient { get; set; } + } +} diff --git a/Models/InequalitySign.cs b/Models/InequalitySign.cs new file mode 100644 index 0000000..edca5b4 --- /dev/null +++ b/Models/InequalitySign.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Common +{ + public enum InequalitySign + { + EqualTo, + LessThanOrEqualTo, + GreaterThanOrEqualTo + } +} diff --git a/Models/InfeasibleException.cs b/Models/InfeasibleException.cs new file mode 100644 index 0000000..acbe412 --- /dev/null +++ b/Models/InfeasibleException.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Models +{ + + [Serializable] + public class InfeasibleException : Exception + { + public InfeasibleException() { } + public InfeasibleException(string message) : base(message) { } + public InfeasibleException(string message, Exception inner) : base(message, inner) { } + protected InfeasibleException( + System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) : base(info, context) { } + } +} diff --git a/Models/Model.cs b/Models/Model.cs new file mode 100644 index 0000000..bf07c2a --- /dev/null +++ b/Models/Model.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Common +{ + public class Model + { + public Model() { } + + // A copy constructor so that we can clone Model objects without reference + public Model(Model model) + { + this.ProblemType = model.ProblemType; + this.ObjectiveFunction = model.ObjectiveFunction; + this.Constraints = model.Constraints; + this.SignRestrictions = model.SignRestrictions; + this.Result = model.Result; + } + + public ProblemType ProblemType { get; set; } + public ObjectiveFunction ObjectiveFunction { get; set; } = new ObjectiveFunction(); + public List Constraints { get; set; } = new List(); + public List SignRestrictions { get; set; } = new List(); + public List>> Result { get; set; } = new List>>(); + } +} diff --git a/Models/ObjectiveFunction.cs b/Models/ObjectiveFunction.cs new file mode 100644 index 0000000..277643e --- /dev/null +++ b/Models/ObjectiveFunction.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Common +{ + public class ObjectiveFunction + { + public List DecisionVariables { get; set; } = new List(); + } +} diff --git a/Models/ProblemType.cs b/Models/ProblemType.cs new file mode 100644 index 0000000..4735c11 --- /dev/null +++ b/Models/ProblemType.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Common +{ + public enum ProblemType + { + Maximization, + Minimization + } +} diff --git a/Models/Properties/AssemblyInfo.cs b/Models/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..dc228d9 --- /dev/null +++ b/Models/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Models")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Models")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("04c11623-f02e-45c6-8c51-82244cff4780")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Models/SignRestriction.cs b/Models/SignRestriction.cs new file mode 100644 index 0000000..d032a59 --- /dev/null +++ b/Models/SignRestriction.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Common +{ + public enum SignRestriction + { + Positive, + Negative, + Unrestricted, + Integer, + Binary + } +} diff --git a/Presentation/MainMenu.cs b/Presentation/MainMenu.cs new file mode 100644 index 0000000..51f2e63 --- /dev/null +++ b/Presentation/MainMenu.cs @@ -0,0 +1,180 @@ +using BusinessLogic; +using BusinessLogic.Algorithms; +using Common; +using DataAccess; +using Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Presentation +{ + public class MainMenu + { + public static void Run() + { + Model model = new Model(); + + try + { + Console.Clear(); + Console.WriteLine("Welcome to the solver"); + Console.WriteLine("========================================================================================================="); + Console.WriteLine("To get started, choose a premade text file that contains the model you would like to solve:"); + Console.WriteLine("\nlimpopo.txt\nsanta.txt\nkorean.txt\nfarmer.txt\nbranch.txt\ncut.txt\nacme.txt\n"); + string modelPath = Console.ReadLine(); + Console.WriteLine("========================================================================================================="); + model = ModelReader.ReadModelFromFile(modelPath); + SolveModelUsingAlgorithm(model); + } + catch (CustomException ex) + { + Console.WriteLine($"There was an error. Details: {ex.Message}."); + Console.WriteLine("\nHere are the tables that were calculated before we ran into that error:"); + SolvedModelPrinter.Print(model); + Console.WriteLine("\n\nPress any key to continue. . ."); + Console.ReadKey(); + Run(); + } + catch (InfeasibleException ex) + { + Console.WriteLine($"There was an error. Details: {ex.Message}."); + Console.WriteLine("\nHere are the tables that were calculated before we ran into that error:"); + SolvedModelPrinter.Print(model); + Console.WriteLine("\n\nPress any key to continue. . ."); + Console.ReadKey(); + Run(); + } + catch (Exception ex) + { + Console.WriteLine($"There was an error. Details: {ex.Message}."); + Console.WriteLine("\nHere are the tables that were calculated before we ran into that error:"); + SolvedModelPrinter.Print(model); + Console.WriteLine("\n\nPress any key to continue. . ."); + Console.ReadKey(); + Run(); + } + } + + private static void SolveModelUsingAlgorithm(Model model) + { + Console.Clear(); + Console.WriteLine("Great! Now that we have your model, the next step is to choose an algorithm to solve it with."); + Console.WriteLine("Based on factors in your model, these are the available algorithms you can use:"); + Console.WriteLine("========================================================================================================="); + + string userInput; + Algorithm algorithm; + + if (model.SignRestrictions.Contains(SignRestriction.Binary) || model.SignRestrictions.Contains(SignRestriction.Integer)) + { + Console.WriteLine("BNB - Branch and Bound Simplex Algorithm"); + Console.WriteLine("CP - Cutting Plane Algorithm"); + userInput = Console.ReadLine(); + + switch (userInput.ToUpper()) + { + case "BNB": + { + algorithm = new BranchAndBoundSimplex(); + } + break; + case "CP": + { + algorithm = new CuttingPlane(); + } + break; + default: + { + throw new CustomException("Invalid selection made"); + } + } + } + else if (model.ProblemType == ProblemType.Minimization) + { + Console.WriteLine("DS - Dual Simplex Algorithm"); + Console.WriteLine("TPS - Two Phase Simplex Algorithm"); + userInput = Console.ReadLine(); + + switch (userInput.ToUpper()) + { + case "DS": + { + algorithm = new DualSimplex(); + } + break; + case "TPS": + { + algorithm = new TwoPhaseSimplex(); + } + break; + default: + { + throw new CustomException("Invalid selection made"); + } + } + } + else + { + if (!(model.Constraints.Any(c => c.InequalitySign == InequalitySign.EqualTo) || + model.Constraints.Any(c => c.InequalitySign == InequalitySign.GreaterThanOrEqualTo))) + { + Console.WriteLine("PS - Primal Simplex"); + userInput = Console.ReadLine(); + + switch (userInput.ToUpper()) + { + case "PS": + { + algorithm = new PrimalSimplex(); + } + break; + default: + { + throw new CustomException("Invalid selection made"); + } + } + } + else + { + Console.WriteLine("DS - Dual Simplex Algorithm"); + Console.WriteLine("TPS - Two Phase Simplex Algorithm"); + userInput = Console.ReadLine(); + + switch (userInput.ToUpper()) + { + case "DS": + { + algorithm = new DualSimplex(); + } + break; + case "TPS": + { + algorithm = new TwoPhaseSimplex(); + } + break; + default: + { + throw new CustomException("Invalid selection made"); + } + } + } + } + + ModelSolver.Solve(model, algorithm); + + if (algorithm.GetType() == typeof(BranchAndBoundSimplex)) + { + SolvedModelPrinter.Print((BranchAndBoundSimplex)algorithm); + ModelWriter.WriteResultsToFile((BranchAndBoundSimplex)algorithm); + } + else + { + SolvedModelPrinter.Print(model); + ModelWriter.WriteResultsToFile(model); + } + } + } +} diff --git a/Presentation/ModelWriter.cs b/Presentation/ModelWriter.cs new file mode 100644 index 0000000..6eeb640 --- /dev/null +++ b/Presentation/ModelWriter.cs @@ -0,0 +1,121 @@ +using BusinessLogic.Algorithms; +using Common; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Presentation +{ + public class ModelWriter + { + public static void WriteResultsToFile(Model model) + { + var fileName = Guid.NewGuid().ToString() + ".txt"; + + using (FileStream stream = new FileStream(fileName, FileMode.Create, FileAccess.Write)) + { + using (StreamWriter writer = new StreamWriter(stream)) + { + int iteration = 0; + + foreach (var table in model.Result) + { + writer.WriteLine($"\n\nTable {iteration}:"); + + for (int i = 0; i < table.Count; i++) + { + for (int j = 0; j < table[0].Count; j++) + { + writer.Write($"\t{table[i][j]:0.###}"); + } + writer.WriteLine(); + } + + iteration++; + } + } + } + + Console.WriteLine($"\n\nThe results have been written to the file: {fileName}"); + } + + public static void WriteResultsToFile(BranchAndBoundSimplex branchAndBoundSimplex) + { + var fileName = Guid.NewGuid().ToString() + ".txt"; + + using (FileStream stream = new FileStream(fileName, FileMode.Create, FileAccess.Write)) + { + using (StreamWriter writer = new StreamWriter(stream)) + { + var tree = branchAndBoundSimplex.Results; + WriteBranchResults(tree.Root, writer); + List> bestCandidate = branchAndBoundSimplex.GetBestCandidate(); + + writer.WriteLine("\n\nThis is the best solution of all the candidates:\n"); + for (int i = 0; i < bestCandidate.Count; i++) + { + for (int j = 0; j < bestCandidate[i].Count; j++) + { + writer.Write($"\t{bestCandidate[i][j]:0.###}"); + } + writer.WriteLine(); + } + } + } + + Console.WriteLine($"\n\nThe results have been written to the file: {fileName}"); + } + + private static void WriteBranchResults(BusinessLogic.BinaryTreeNode root, StreamWriter writer, string previousProblem = "0") + { + if (root == null) + return; + + if (previousProblem.Equals("0")) + { + writer.WriteLine("\n\n"); + writer.WriteLine("Sub-Problem 0"); + + for (int i = 0; i < root.Data.Count; i++) + { + for (int j = 0; j < root.Data[i].Count; j++) + { + for (int k = 0; k < root.Data[i][j].Count; k++) + { + writer.Write($"\t{root.Data[i][j][k]:0.###}"); + } + writer.WriteLine(); + } + writer.WriteLine("\n\n"); + } + + WriteBranchResults(root.LeftNode, writer, "1"); + WriteBranchResults(root.RightNode, writer, "2"); + } + else + { + writer.WriteLine("\n\n"); + writer.WriteLine($"Sub-Problem {previousProblem}"); + + for (int i = 0; i < root.Data.Count; i++) + { + for (int j = 0; j < root.Data[i].Count; j++) + { + for (int k = 0; k < root.Data[i][j].Count; k++) + { + writer.Write($"\t{root.Data[i][j][k]:0.###}"); + } + writer.WriteLine(); + } + writer.WriteLine("\n\n"); + } + + WriteBranchResults(root.LeftNode, writer, previousProblem + ".1"); + WriteBranchResults(root.RightNode, writer, previousProblem + ".2"); + } + } + } +} diff --git a/Presentation/Presentation.csproj b/Presentation/Presentation.csproj new file mode 100644 index 0000000..a368af3 --- /dev/null +++ b/Presentation/Presentation.csproj @@ -0,0 +1,70 @@ + + + + + Debug + AnyCPU + {377D38FE-AA9D-4AB0-B743-9E80AA0C82C4} + Library + Properties + Presentation + Presentation + v4.8 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\ConsoleTables.2.4.2\lib\net40\ConsoleTables.dll + + + + + + + + + + + + + + + + + + + {F904DA9B-8BA5-4803-88C1-24A6471C7FEF} + BusinessLogic + + + {02E85643-5DA8-4A1E-AF07-10184FC132A0} + DataAccess + + + {04C11623-F02E-45C6-8C51-82244CFF4780} + Common + + + + + + + \ No newline at end of file diff --git a/Presentation/Properties/AssemblyInfo.cs b/Presentation/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ee703a9 --- /dev/null +++ b/Presentation/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Presentation")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Presentation")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("377d38fe-aa9d-4ab0-b743-9e80aa0c82c4")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Presentation/SolvedModelPrinter.cs b/Presentation/SolvedModelPrinter.cs new file mode 100644 index 0000000..73ccf07 --- /dev/null +++ b/Presentation/SolvedModelPrinter.cs @@ -0,0 +1,112 @@ +using BusinessLogic; +using BusinessLogic.Algorithms; +using Common; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ConsoleTables; + +namespace Presentation +{ + public class SolvedModelPrinter + { + public static void Print(Model model) + { + int iteration = 0; + + foreach (var table in model.Result) + { + Console.WriteLine($"\n\nTable {iteration}:"); + string[] headers = new string[table[0].Count]; + string temp = ""; + for (int j = 0; j < table[0].Count; j++) + { + temp = table[0][j].ToString(); + headers[j] = temp; + } + table.RemoveAt(0); + var conTable = new ConsoleTable(headers); + foreach (List row in table) + { + object[] rowArray = new object[row.Count]; + for (int i = 0; i < row.Count; i++) + { + rowArray[i] = row[i]; + } + conTable.AddRow(rowArray); + } + Console.WriteLine(); + iteration++; + conTable.Write(Format.Alternative); + } + } + + public static void Print(BranchAndBoundSimplex branchAndBoundSimplex) + { + var tree = branchAndBoundSimplex.Results; + PrintBranchResults(tree.Root); + List> bestCandidate = branchAndBoundSimplex.GetBestCandidate(); + + Console.WriteLine("\n\nThis is the best solution of all the candidates:\n"); + for (int i = 0; i < bestCandidate.Count; i++) + { + for (int j = 0; j < bestCandidate[i].Count; j++) + { + Console.Write($"\t{bestCandidate[i][j]:0.###}"); + } + Console.WriteLine(); + } + } + + private static void PrintBranchResults(BinaryTreeNode root, string previousProblem = "0") + { + if (root == null) + return; + + if (previousProblem.Equals("0")) + { + Console.WriteLine("\n\n"); + Console.WriteLine("Sub-Problem 0"); + + for (int i = 0; i < root.Data.Count; i++) + { + for (int j = 0; j < root.Data[i].Count; j++) + { + for (int k = 0; k < root.Data[i][j].Count; k++) + { + Console.Write($"\t{root.Data[i][j][k]:0.###}"); + } + Console.WriteLine(); + } + Console.WriteLine("\n\n"); + } + + PrintBranchResults(root.LeftNode, "1"); + PrintBranchResults(root.RightNode, "2"); + } + else + { + Console.WriteLine("\n\n"); + Console.WriteLine($"Sub-Problem {previousProblem}"); + + for (int i = 0; i < root.Data.Count; i++) + { + for (int j = 0; j < root.Data[i].Count; j++) + { + for (int k = 0; k < root.Data[i][j].Count; k++) + { + Console.Write($"\t{root.Data[i][j][k]:0.###}"); + } + Console.WriteLine(); + } + Console.WriteLine("\n\n"); + } + + PrintBranchResults(root.LeftNode, previousProblem + ".1"); + PrintBranchResults(root.RightNode, previousProblem + ".2"); + } + } + } +} diff --git a/Presentation/packages.config b/Presentation/packages.config new file mode 100644 index 0000000..f00be04 --- /dev/null +++ b/Presentation/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Program.cs b/Program.cs deleted file mode 100644 index 7b24a41..0000000 --- a/Program.cs +++ /dev/null @@ -1,16 +0,0 @@ - -class lpr381 -{ - static void Main() - { - //simplex simplex = new simplex(); - //simplex.simplexAlgo(); - //twoPhaseSimplex twoPhaseSimplex = new twoPhaseSimplex(); - //twoPhaseSimplex.twoPhaseSimplexAlgo(); - //chesssolver chesssolver = new chesssolver(); - //chesssolver.chessAlgo(); - dualSimplex dualSimplex = new dualSimplex(); - dualSimplex.dualSimplexAlgo(); - } -} - diff --git a/chess.cs b/chess.cs deleted file mode 100644 index 2f25a44..0000000 --- a/chess.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - - class chesssolver - { - static int N; - static void printBoard(int[,] board) - { - for (int i = 0; i < N; i++) - { - for (int j = 0; j < N; j++) - { - Console.Write(board[i, j] + " "); - } - Console.Write("\n"); - } - } - static Boolean toPlaceOrNotToPlace(int[,] board, int row, int col) - { - int i, j; - for (i = 0; i < col; i++) - { - if (board[row, i] == 1) return false; - } - for (i = row, j = col; i >= 0 && j >= 0; i--, j--) - { - if (board[i, j] == 1) return false; - } - for (i = row, j = col; j >= 0 && i < N; i++, j--) - { - if (board[i, j] == 1) return false; - } - return true; - } - static Boolean theBoardSolver(int[,] board, int col) - { - if (col >= N) return true; - for (int i = 0; i < N; i++) - { - if (toPlaceOrNotToPlace(board, i, col)) - { - board[i, col] = 1; - if (theBoardSolver(board, col + 1)) return true; - - board[i, col] = 0; - } - } - return false; - } - public void chessAlgo() - { - Console.WriteLine("state size of chess table example: 4"); - N = Convert.ToInt32(Console.ReadLine()); - int[,] board = new int[N, N]; - if (!theBoardSolver(board, 0)) - { - Console.WriteLine("Solution not found."); - } - printBoard(board); - Console.ReadLine(); - } - } diff --git a/dualSimplex.cs b/dualSimplex.cs deleted file mode 100644 index 6423669..0000000 --- a/dualSimplex.cs +++ /dev/null @@ -1,223 +0,0 @@ -using ConsoleTables; - -class dualSimplex -{ - public void dualSimplexAlgo() - { - file file = new file(); - Tuple, List> content = file.readFile(); - List zConstraintsList = content.Item1; - List constraintsList = content.Item2; - - // print constraintsList - foreach (zConstraints constraints in zConstraintsList) - { - Console.WriteLine(constraints.minMax + " " + string.Join(" ", constraints.values)); - } - foreach (Constraints constraints in constraintsList) - { - Console.WriteLine(constraints.sign + " " + string.Join(" ", constraints.values)); - } - List> table = new List>(); - table.Add(zConstraintsList[0].values); - // add all constraints in constraintsList to table - foreach (Constraints constraints in constraintsList) - { - table.Add(constraints.values); - } - List> newTable = new List>(); - - // add all rows in table to newTable - foreach (List row in table) - { - // add all columns in row to newTable without reference to table - List newRow = new List(); - for (int i = 0; i < row.Count; i++) - { - newRow.Add(row[i]); - - } - newTable.Add(newRow); - } - int varCount = newTable[0].Count; - table = prepareTable(newTable, constraintsList); - // print every row in table - printTable(table, varCount); - - } - - - List> prepareTable(List> table, List constraints) - { - List> newTable = new List>(); - foreach (List row in table) - { - List newRow = new List(); - foreach (float value in row) - { - newRow.Add(value); - } - newTable.Add(newRow); - } - List signs = new List(); - foreach (Constraints constraint in constraints) - { - signs.Add(constraint.sign); - } - for (int i = 0; i < signs.Count ; i++) - { - table[0].Add(0); - table[0].Add(0); - - // if sign[i] == "=" copy table[i] to table[i+1] without overwriting table[i+1] - if (signs[i] == "=") - { - List tempRow = new List(); - foreach (float value in table[i+1]) - { - tempRow.Add(value); - } - table.Add(tempRow); - // move last row of table to table[i+2] - for (int j = table.Count - 1; j > i+2; j--) - { - List row = table[j]; - table[j] = table[j-1]; - table[j-1] = row; - } - signs.Add("2="); - for (int j = signs.Count - 1; j > i + 1; j--) - { - string sign = signs[j]; - signs[j] = signs[j-1]; - signs[j-1] = sign; - } - newTable.Insert(i+1, newTable[i+1]); - } - - if (signs[i] == ">=") - { - // multiply table[i+1] by -1 - for (int j = 0; j < table[i+1].Count; j++) - { - table[i+1][j] = table[i+1][j] * -1; - } - } - - // add 3 0s to each row for every column in table - for (int j = 0; j < signs.Count ; j++) - { - if (signs[i] == ">=") - { - // make s = 1 - if (i == j) - { - table[i+1].Add(0); - table[i+1].Add(1); - } - else - { - table[i+1].Add(0); - table[i+1].Add(0); - } - } - else if (signs[i] == "<=") - { - //make e = 1 - if (i == j) - { - table[i+1].Add(-1); - table[i+1].Add(0); - } - else - { - table[i+1].Add(0); - table[i+1].Add(0); - } - } - else if (signs[i] == "=") - { - // make a = 1 - if (i == j) - { - table[i+1].Add(-1); - table[i+1].Add(0); - } - else - { - table[i+1].Add(0); - table[i+1].Add(0); - } - } - else if (signs[i] == "2=") - { - // make a = 1 - if (i == j) - { - table[i+1].Add(0); - table[i+1].Add(1); - } - else - { - table[i+1].Add(0); - table[i+1].Add(0); - } - } - } - } - table[0].Add(0); - - // remove intex newTable.Count-1 from table and place it in the back of table - for (int i = 1; i < table.Count; i++) - { - table[i].RemoveAt(newTable[i].Count-1); - if (signs[i-1] == ">=" || signs[i-1] == "2=") - { - table[i].Add(newTable[i][newTable[i].Count-1] * -1); - } - else - { - table[i].Add(newTable[i][newTable[i].Count-1]); - } - - } - // remove the value of newTable.Count-1 from table[1] and place it in the back of table[1] - return table; - } - - void printTable(List> table, int varCount) - { - int count = 1; - string[] headers = new string[table[0].Count]; - for (int i = 0; i < table[0].Count; i++) - { - if (i < varCount) - { - headers[i] = "x" + (i + 1); - } - else if (i < table[0].Count - 1) - { - headers[i] = "e" + (count); - headers[i+1] = "s" + (count); - i = i + 1; - count++; - } - else - { - headers[i] = "rhs"; - } - } - var conTable = new ConsoleTable(headers); - foreach (List row in table) - { - // convert row to object array - object[] rowArray = new object[row.Count]; - for (int i = 0; i < row.Count; i++) - { - rowArray[i] = row[i]; - } - conTable.AddRow(rowArray); - } - conTable.Write(Format.Alternative); - } -} \ No newline at end of file diff --git a/file.cs b/file.cs deleted file mode 100644 index fc52588..0000000 --- a/file.cs +++ /dev/null @@ -1,81 +0,0 @@ -class file -{ - public Tuple,List> readFile() - { - List zConstraintsList = new List(); - List constraintsList = new List(); - //read file "input.txt" line by line - string line; - StreamReader file = new StreamReader("input.txt"); - while ((line = file.ReadLine()) != null) - { - // if line contains "min" or "max" - if (line.Contains("min") || line.Contains("max")) - { - zConstraints constraints = new zConstraints(); - if (line.Contains("min")) - { - constraints.minMax = "min"; - } - else - { - constraints.minMax = "max"; - } - // remove "min" or "max" from line - line = line.Remove(0, line.IndexOf(constraints.minMax) + constraints.minMax.Length); - // split line by " " - string[] lineArray = line.Split(' '); - //remove empty elements from array - lineArray = lineArray.Where(x => !string.IsNullOrEmpty(x)).ToArray(); - - // add variables to constraints.variables after parsing them to float - List variables = new List(); - foreach (string variable in lineArray) - { - variables.Add(float.Parse(variable)); - - } - constraints.values = variables; - // add constraints to list - zConstraintsList.Add(constraints); - } - else - { - // split line by " " - string[] lineArray = line.Split(' '); - //remove empty elements from array - lineArray = lineArray.Where(x => !string.IsNullOrEmpty(x)).ToArray(); - // for each element in array - Constraints constraints = new Constraints(); - List variables = new List(); - foreach (string variable in lineArray) - { - if (variable.Contains("=") || variable.Contains(">") || variable.Contains("<")) - { - constraints.sign = variable; - } - else - { - variables.Add(float.Parse(variable)); - } - } - constraints.values = variables; - constraintsList.Add(constraints); - } - } - file.Close(); - return new Tuple, List>(zConstraintsList, constraintsList); - } -} -class zConstraints -{ - public string minMax; - public List values; -} - -class Constraints -{ - public List values; - - public string sign; -} \ No newline at end of file diff --git a/input.txt b/input.txt deleted file mode 100644 index 26dcc6e..0000000 --- a/input.txt +++ /dev/null @@ -1,8 +0,0 @@ -max +1 +1 -+8 +4 = 160 -+4 +4 <= 100 -+1 +0 <= 17 -+1 +0 >= 5 -+0 +1 >= 2 -+1 -1 >= 0 -+1 -4 <= 0 \ No newline at end of file diff --git a/lpr381.csproj b/lpr381.csproj deleted file mode 100644 index 3e87d60..0000000 --- a/lpr381.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - Exe - net6.0 - enable - enable - - - - - - - diff --git a/obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs b/obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs deleted file mode 100644 index 36203c7..0000000 --- a/obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs +++ /dev/null @@ -1,4 +0,0 @@ -// -using System; -using System.Reflection; -[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")] diff --git a/obj/Debug/net6.0/apphost b/obj/Debug/net6.0/apphost deleted file mode 100755 index 7f19e3f..0000000 Binary files a/obj/Debug/net6.0/apphost and /dev/null differ diff --git a/obj/Debug/net6.0/lpr381.AssemblyInfo.cs b/obj/Debug/net6.0/lpr381.AssemblyInfo.cs deleted file mode 100644 index 3a56d86..0000000 --- a/obj/Debug/net6.0/lpr381.AssemblyInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -using System; -using System.Reflection; - -[assembly: System.Reflection.AssemblyCompanyAttribute("lpr381")] -[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] -[assembly: System.Reflection.AssemblyProductAttribute("lpr381")] -[assembly: System.Reflection.AssemblyTitleAttribute("lpr381")] -[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] - -// Generated by the MSBuild WriteCodeFragment class. - diff --git a/obj/Debug/net6.0/lpr381.AssemblyInfoInputs.cache b/obj/Debug/net6.0/lpr381.AssemblyInfoInputs.cache deleted file mode 100644 index 7a1b048..0000000 --- a/obj/Debug/net6.0/lpr381.AssemblyInfoInputs.cache +++ /dev/null @@ -1 +0,0 @@ -19ef02a5be1a65bf6b975f4a44f162accba6b382 diff --git a/obj/Debug/net6.0/lpr381.GeneratedMSBuildEditorConfig.editorconfig b/obj/Debug/net6.0/lpr381.GeneratedMSBuildEditorConfig.editorconfig deleted file mode 100644 index d611449..0000000 --- a/obj/Debug/net6.0/lpr381.GeneratedMSBuildEditorConfig.editorconfig +++ /dev/null @@ -1,10 +0,0 @@ -is_global = true -build_property.TargetFramework = net6.0 -build_property.TargetPlatformMinVersion = -build_property.UsingMicrosoftNETSdkWeb = -build_property.ProjectTypeGuids = -build_property.InvariantGlobalization = -build_property.PlatformNeutralAssembly = -build_property._SupportedPlatformList = Linux,macOS,Windows -build_property.RootNamespace = lpr381 -build_property.ProjectDir = /home/mrfluffy/Documents/c#/lpr381/ diff --git a/obj/Debug/net6.0/lpr381.GlobalUsings.g.cs b/obj/Debug/net6.0/lpr381.GlobalUsings.g.cs deleted file mode 100644 index 8578f3d..0000000 --- a/obj/Debug/net6.0/lpr381.GlobalUsings.g.cs +++ /dev/null @@ -1,8 +0,0 @@ -// -global using global::System; -global using global::System.Collections.Generic; -global using global::System.IO; -global using global::System.Linq; -global using global::System.Net.Http; -global using global::System.Threading; -global using global::System.Threading.Tasks; diff --git a/obj/Debug/net6.0/lpr381.assets.cache b/obj/Debug/net6.0/lpr381.assets.cache deleted file mode 100644 index 0c3df25..0000000 Binary files a/obj/Debug/net6.0/lpr381.assets.cache and /dev/null differ diff --git a/obj/Debug/net6.0/lpr381.csproj.AssemblyReference.cache b/obj/Debug/net6.0/lpr381.csproj.AssemblyReference.cache deleted file mode 100644 index 24f85a7..0000000 Binary files a/obj/Debug/net6.0/lpr381.csproj.AssemblyReference.cache and /dev/null differ diff --git a/obj/Debug/net6.0/lpr381.csproj.CopyComplete b/obj/Debug/net6.0/lpr381.csproj.CopyComplete deleted file mode 100644 index e69de29..0000000 diff --git a/obj/Debug/net6.0/lpr381.csproj.CoreCompileInputs.cache b/obj/Debug/net6.0/lpr381.csproj.CoreCompileInputs.cache deleted file mode 100644 index dfdc1a2..0000000 --- a/obj/Debug/net6.0/lpr381.csproj.CoreCompileInputs.cache +++ /dev/null @@ -1 +0,0 @@ -8c13023fa8aa1aee00b6cf6a6819800d58bb1521 diff --git a/obj/Debug/net6.0/lpr381.csproj.FileListAbsolute.txt b/obj/Debug/net6.0/lpr381.csproj.FileListAbsolute.txt deleted file mode 100644 index 40c2278..0000000 --- a/obj/Debug/net6.0/lpr381.csproj.FileListAbsolute.txt +++ /dev/null @@ -1,17 +0,0 @@ -/home/mrfluffy/Documents/c#/lpr381/obj/Debug/net6.0/lpr381.csproj.AssemblyReference.cache -/home/mrfluffy/Documents/c#/lpr381/obj/Debug/net6.0/lpr381.GeneratedMSBuildEditorConfig.editorconfig -/home/mrfluffy/Documents/c#/lpr381/obj/Debug/net6.0/lpr381.AssemblyInfoInputs.cache -/home/mrfluffy/Documents/c#/lpr381/obj/Debug/net6.0/lpr381.AssemblyInfo.cs -/home/mrfluffy/Documents/c#/lpr381/obj/Debug/net6.0/lpr381.csproj.CoreCompileInputs.cache -/home/mrfluffy/Documents/c#/lpr381/bin/Debug/net6.0/lpr381 -/home/mrfluffy/Documents/c#/lpr381/bin/Debug/net6.0/lpr381.deps.json -/home/mrfluffy/Documents/c#/lpr381/bin/Debug/net6.0/lpr381.runtimeconfig.json -/home/mrfluffy/Documents/c#/lpr381/bin/Debug/net6.0/lpr381.dll -/home/mrfluffy/Documents/c#/lpr381/bin/Debug/net6.0/ref/lpr381.dll -/home/mrfluffy/Documents/c#/lpr381/bin/Debug/net6.0/lpr381.pdb -/home/mrfluffy/Documents/c#/lpr381/obj/Debug/net6.0/lpr381.dll -/home/mrfluffy/Documents/c#/lpr381/obj/Debug/net6.0/ref/lpr381.dll -/home/mrfluffy/Documents/c#/lpr381/obj/Debug/net6.0/lpr381.pdb -/home/mrfluffy/Documents/c#/lpr381/obj/Debug/net6.0/lpr381.genruntimeconfig.cache -/home/mrfluffy/Documents/c#/lpr381/obj/Debug/net6.0/lpr381.csproj.CopyComplete -/home/mrfluffy/Documents/c#/lpr381/bin/Debug/net6.0/ConsoleTables.dll diff --git a/obj/Debug/net6.0/lpr381.dll b/obj/Debug/net6.0/lpr381.dll deleted file mode 100644 index 804d884..0000000 Binary files a/obj/Debug/net6.0/lpr381.dll and /dev/null differ diff --git a/obj/Debug/net6.0/lpr381.genruntimeconfig.cache b/obj/Debug/net6.0/lpr381.genruntimeconfig.cache deleted file mode 100644 index e38da22..0000000 --- a/obj/Debug/net6.0/lpr381.genruntimeconfig.cache +++ /dev/null @@ -1 +0,0 @@ -1e253571666f59f5c0ab7c37c5d596e5501a216c diff --git a/obj/Debug/net6.0/lpr381.pdb b/obj/Debug/net6.0/lpr381.pdb deleted file mode 100644 index b6147dc..0000000 Binary files a/obj/Debug/net6.0/lpr381.pdb and /dev/null differ diff --git a/obj/Debug/net6.0/ref/lpr381.dll b/obj/Debug/net6.0/ref/lpr381.dll deleted file mode 100644 index 5fbb2f8..0000000 Binary files a/obj/Debug/net6.0/ref/lpr381.dll and /dev/null differ diff --git a/obj/Release/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs b/obj/Release/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs deleted file mode 100644 index 36203c7..0000000 --- a/obj/Release/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs +++ /dev/null @@ -1,4 +0,0 @@ -// -using System; -using System.Reflection; -[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")] diff --git a/obj/Release/net6.0/apphost b/obj/Release/net6.0/apphost deleted file mode 100755 index 7f19e3f..0000000 Binary files a/obj/Release/net6.0/apphost and /dev/null differ diff --git a/obj/Release/net6.0/lpr381.AssemblyInfo.cs b/obj/Release/net6.0/lpr381.AssemblyInfo.cs deleted file mode 100644 index bf0c04a..0000000 --- a/obj/Release/net6.0/lpr381.AssemblyInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -using System; -using System.Reflection; - -[assembly: System.Reflection.AssemblyCompanyAttribute("lpr381")] -[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] -[assembly: System.Reflection.AssemblyProductAttribute("lpr381")] -[assembly: System.Reflection.AssemblyTitleAttribute("lpr381")] -[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] - -// Generated by the MSBuild WriteCodeFragment class. - diff --git a/obj/Release/net6.0/lpr381.AssemblyInfoInputs.cache b/obj/Release/net6.0/lpr381.AssemblyInfoInputs.cache deleted file mode 100644 index 2efcca9..0000000 --- a/obj/Release/net6.0/lpr381.AssemblyInfoInputs.cache +++ /dev/null @@ -1 +0,0 @@ -b9e0021e723c322ac0b279cab44aef39129eb7a8 diff --git a/obj/Release/net6.0/lpr381.GeneratedMSBuildEditorConfig.editorconfig b/obj/Release/net6.0/lpr381.GeneratedMSBuildEditorConfig.editorconfig deleted file mode 100644 index d611449..0000000 --- a/obj/Release/net6.0/lpr381.GeneratedMSBuildEditorConfig.editorconfig +++ /dev/null @@ -1,10 +0,0 @@ -is_global = true -build_property.TargetFramework = net6.0 -build_property.TargetPlatformMinVersion = -build_property.UsingMicrosoftNETSdkWeb = -build_property.ProjectTypeGuids = -build_property.InvariantGlobalization = -build_property.PlatformNeutralAssembly = -build_property._SupportedPlatformList = Linux,macOS,Windows -build_property.RootNamespace = lpr381 -build_property.ProjectDir = /home/mrfluffy/Documents/c#/lpr381/ diff --git a/obj/Release/net6.0/lpr381.GlobalUsings.g.cs b/obj/Release/net6.0/lpr381.GlobalUsings.g.cs deleted file mode 100644 index 8578f3d..0000000 --- a/obj/Release/net6.0/lpr381.GlobalUsings.g.cs +++ /dev/null @@ -1,8 +0,0 @@ -// -global using global::System; -global using global::System.Collections.Generic; -global using global::System.IO; -global using global::System.Linq; -global using global::System.Net.Http; -global using global::System.Threading; -global using global::System.Threading.Tasks; diff --git a/obj/Release/net6.0/lpr381.assets.cache b/obj/Release/net6.0/lpr381.assets.cache deleted file mode 100644 index 25c323c..0000000 Binary files a/obj/Release/net6.0/lpr381.assets.cache and /dev/null differ diff --git a/obj/Release/net6.0/lpr381.csproj.AssemblyReference.cache b/obj/Release/net6.0/lpr381.csproj.AssemblyReference.cache deleted file mode 100644 index 2f99fd8..0000000 Binary files a/obj/Release/net6.0/lpr381.csproj.AssemblyReference.cache and /dev/null differ diff --git a/obj/Release/net6.0/lpr381.csproj.CoreCompileInputs.cache b/obj/Release/net6.0/lpr381.csproj.CoreCompileInputs.cache deleted file mode 100644 index 3d1e6ae..0000000 --- a/obj/Release/net6.0/lpr381.csproj.CoreCompileInputs.cache +++ /dev/null @@ -1 +0,0 @@ -1451b566708a8403bb7092754722413801261e62 diff --git a/obj/Release/net6.0/lpr381.csproj.FileListAbsolute.txt b/obj/Release/net6.0/lpr381.csproj.FileListAbsolute.txt deleted file mode 100644 index e85edad..0000000 --- a/obj/Release/net6.0/lpr381.csproj.FileListAbsolute.txt +++ /dev/null @@ -1,15 +0,0 @@ -/home/mrfluffy/Documents/c#/lpr381/bin/Release/net6.0/lpr381 -/home/mrfluffy/Documents/c#/lpr381/bin/Release/net6.0/lpr381.deps.json -/home/mrfluffy/Documents/c#/lpr381/bin/Release/net6.0/lpr381.runtimeconfig.json -/home/mrfluffy/Documents/c#/lpr381/bin/Release/net6.0/lpr381.dll -/home/mrfluffy/Documents/c#/lpr381/bin/Release/net6.0/ref/lpr381.dll -/home/mrfluffy/Documents/c#/lpr381/bin/Release/net6.0/lpr381.pdb -/home/mrfluffy/Documents/c#/lpr381/obj/Release/net6.0/lpr381.csproj.AssemblyReference.cache -/home/mrfluffy/Documents/c#/lpr381/obj/Release/net6.0/lpr381.GeneratedMSBuildEditorConfig.editorconfig -/home/mrfluffy/Documents/c#/lpr381/obj/Release/net6.0/lpr381.AssemblyInfoInputs.cache -/home/mrfluffy/Documents/c#/lpr381/obj/Release/net6.0/lpr381.AssemblyInfo.cs -/home/mrfluffy/Documents/c#/lpr381/obj/Release/net6.0/lpr381.csproj.CoreCompileInputs.cache -/home/mrfluffy/Documents/c#/lpr381/obj/Release/net6.0/lpr381.dll -/home/mrfluffy/Documents/c#/lpr381/obj/Release/net6.0/ref/lpr381.dll -/home/mrfluffy/Documents/c#/lpr381/obj/Release/net6.0/lpr381.pdb -/home/mrfluffy/Documents/c#/lpr381/obj/Release/net6.0/lpr381.genruntimeconfig.cache diff --git a/obj/Release/net6.0/lpr381.dll b/obj/Release/net6.0/lpr381.dll deleted file mode 100644 index 4120cd9..0000000 Binary files a/obj/Release/net6.0/lpr381.dll and /dev/null differ diff --git a/obj/Release/net6.0/lpr381.genruntimeconfig.cache b/obj/Release/net6.0/lpr381.genruntimeconfig.cache deleted file mode 100644 index 64c2c6e..0000000 --- a/obj/Release/net6.0/lpr381.genruntimeconfig.cache +++ /dev/null @@ -1 +0,0 @@ -670f060e3646ff2f7e8cdecd2b3e98bee644fdfb diff --git a/obj/Release/net6.0/lpr381.pdb b/obj/Release/net6.0/lpr381.pdb deleted file mode 100644 index 2bbf5cc..0000000 Binary files a/obj/Release/net6.0/lpr381.pdb and /dev/null differ diff --git a/obj/Release/net6.0/ref/lpr381.dll b/obj/Release/net6.0/ref/lpr381.dll deleted file mode 100644 index 2369112..0000000 Binary files a/obj/Release/net6.0/ref/lpr381.dll and /dev/null differ diff --git a/obj/lpr381.csproj.nuget.dgspec.json b/obj/lpr381.csproj.nuget.dgspec.json deleted file mode 100644 index 97d3620..0000000 --- a/obj/lpr381.csproj.nuget.dgspec.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "format": 1, - "restore": { - "/home/mrfluffy/Documents/c#/lpr381/lpr381.csproj": {} - }, - "projects": { - "/home/mrfluffy/Documents/c#/lpr381/lpr381.csproj": { - "version": "1.0.0", - "restore": { - "projectUniqueName": "/home/mrfluffy/Documents/c#/lpr381/lpr381.csproj", - "projectName": "lpr381", - "projectPath": "/home/mrfluffy/Documents/c#/lpr381/lpr381.csproj", - "packagesPath": "/home/mrfluffy/.cache/NuGetPackages", - "outputPath": "/home/mrfluffy/Documents/c#/lpr381/obj/", - "projectStyle": "PackageReference", - "configFilePaths": [ - "/home/mrfluffy/.nuget/NuGet/NuGet.Config" - ], - "originalTargetFrameworks": [ - "net6.0" - ], - "sources": { - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "net6.0": { - "targetAlias": "net6.0", - "projectReferences": {} - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - } - }, - "frameworks": { - "net6.0": { - "targetAlias": "net6.0", - "dependencies": { - "ConsoleTables": { - "target": "Package", - "version": "[2.4.2, )" - } - }, - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48" - ], - "assetTargetFallback": true, - "warn": true, - "downloadDependencies": [ - { - "name": "Microsoft.AspNetCore.App.Ref", - "version": "[6.0.6, 6.0.6]" - } - ], - "frameworkReferences": { - "Microsoft.NETCore.App": { - "privateAssets": "all" - } - }, - "runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/6.0.106/RuntimeIdentifierGraph.json" - } - } - } - } -} \ No newline at end of file diff --git a/obj/lpr381.csproj.nuget.g.props b/obj/lpr381.csproj.nuget.g.props deleted file mode 100644 index 063c70c..0000000 --- a/obj/lpr381.csproj.nuget.g.props +++ /dev/null @@ -1,15 +0,0 @@ - - - - True - NuGet - $(MSBuildThisFileDirectory)project.assets.json - /home/mrfluffy/.cache/NuGetPackages - /home/mrfluffy/.cache/NuGetPackages - PackageReference - 6.0.2 - - - - - \ No newline at end of file diff --git a/obj/lpr381.csproj.nuget.g.targets b/obj/lpr381.csproj.nuget.g.targets deleted file mode 100644 index 3dc06ef..0000000 --- a/obj/lpr381.csproj.nuget.g.targets +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/obj/project.assets.json b/obj/project.assets.json deleted file mode 100644 index 1d2eef3..0000000 --- a/obj/project.assets.json +++ /dev/null @@ -1,741 +0,0 @@ -{ - "version": 3, - "targets": { - "net6.0": { - "ConsoleTables/2.4.2": { - "type": "package", - "dependencies": { - "System.Reflection.TypeExtensions": "4.3.0" - }, - "compile": { - "lib/netcoreapp3.1/ConsoleTables.dll": {} - }, - "runtime": { - "lib/netcoreapp3.1/ConsoleTables.dll": {} - } - }, - "Microsoft.NETCore.Platforms/1.1.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Microsoft.NETCore.Targets/1.1.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "System.IO/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.IO.dll": {} - } - }, - "System.Reflection/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Reflection.dll": {} - } - }, - "System.Reflection.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Primitives.dll": {} - } - }, - "System.Reflection.TypeExtensions/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Reflection.TypeExtensions.dll": {} - }, - "runtime": { - "lib/netstandard1.5/System.Reflection.TypeExtensions.dll": {} - } - }, - "System.Runtime/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.dll": {} - } - }, - "System.Text.Encoding/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Text.Encoding.dll": {} - } - }, - "System.Threading.Tasks/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.Tasks.dll": {} - } - } - } - }, - "libraries": { - "ConsoleTables/2.4.2": { - "sha512": "0SRFOWYCgFQ0RfAMof2DsGEJHI2YKquCA4X26kKyuG+MG+/2R3NRgRVEqXDMU7eVP69MGDzb1eg4i3/APlIfQg==", - "type": "package", - "path": "consoletables/2.4.2", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "consoletables.2.4.2.nupkg.sha512", - "consoletables.nuspec", - "lib/net40/ConsoleTables.dll", - "lib/net40/ConsoleTables.pdb", - "lib/netcoreapp3.1/ConsoleTables.dll", - "lib/netcoreapp3.1/ConsoleTables.pdb", - "lib/netstandard1.3/ConsoleTables.dll", - "lib/netstandard1.3/ConsoleTables.pdb" - ] - }, - "Microsoft.NETCore.Platforms/1.1.0": { - "sha512": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==", - "type": "package", - "path": "microsoft.netcore.platforms/1.1.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "microsoft.netcore.platforms.1.1.0.nupkg.sha512", - "microsoft.netcore.platforms.nuspec", - "runtime.json" - ] - }, - "Microsoft.NETCore.Targets/1.1.0": { - "sha512": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==", - "type": "package", - "path": "microsoft.netcore.targets/1.1.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "microsoft.netcore.targets.1.1.0.nupkg.sha512", - "microsoft.netcore.targets.nuspec", - "runtime.json" - ] - }, - "System.IO/4.3.0": { - "sha512": "3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", - "type": "package", - "path": "system.io/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.IO.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.IO.dll", - "ref/netcore50/System.IO.dll", - "ref/netcore50/System.IO.xml", - "ref/netcore50/de/System.IO.xml", - "ref/netcore50/es/System.IO.xml", - "ref/netcore50/fr/System.IO.xml", - "ref/netcore50/it/System.IO.xml", - "ref/netcore50/ja/System.IO.xml", - "ref/netcore50/ko/System.IO.xml", - "ref/netcore50/ru/System.IO.xml", - "ref/netcore50/zh-hans/System.IO.xml", - "ref/netcore50/zh-hant/System.IO.xml", - "ref/netstandard1.0/System.IO.dll", - "ref/netstandard1.0/System.IO.xml", - "ref/netstandard1.0/de/System.IO.xml", - "ref/netstandard1.0/es/System.IO.xml", - "ref/netstandard1.0/fr/System.IO.xml", - "ref/netstandard1.0/it/System.IO.xml", - "ref/netstandard1.0/ja/System.IO.xml", - "ref/netstandard1.0/ko/System.IO.xml", - "ref/netstandard1.0/ru/System.IO.xml", - "ref/netstandard1.0/zh-hans/System.IO.xml", - "ref/netstandard1.0/zh-hant/System.IO.xml", - "ref/netstandard1.3/System.IO.dll", - "ref/netstandard1.3/System.IO.xml", - "ref/netstandard1.3/de/System.IO.xml", - "ref/netstandard1.3/es/System.IO.xml", - "ref/netstandard1.3/fr/System.IO.xml", - "ref/netstandard1.3/it/System.IO.xml", - "ref/netstandard1.3/ja/System.IO.xml", - "ref/netstandard1.3/ko/System.IO.xml", - "ref/netstandard1.3/ru/System.IO.xml", - "ref/netstandard1.3/zh-hans/System.IO.xml", - "ref/netstandard1.3/zh-hant/System.IO.xml", - "ref/netstandard1.5/System.IO.dll", - "ref/netstandard1.5/System.IO.xml", - "ref/netstandard1.5/de/System.IO.xml", - "ref/netstandard1.5/es/System.IO.xml", - "ref/netstandard1.5/fr/System.IO.xml", - "ref/netstandard1.5/it/System.IO.xml", - "ref/netstandard1.5/ja/System.IO.xml", - "ref/netstandard1.5/ko/System.IO.xml", - "ref/netstandard1.5/ru/System.IO.xml", - "ref/netstandard1.5/zh-hans/System.IO.xml", - "ref/netstandard1.5/zh-hant/System.IO.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.io.4.3.0.nupkg.sha512", - "system.io.nuspec" - ] - }, - "System.Reflection/4.3.0": { - "sha512": "KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", - "type": "package", - "path": "system.reflection/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Reflection.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Reflection.dll", - "ref/netcore50/System.Reflection.dll", - "ref/netcore50/System.Reflection.xml", - "ref/netcore50/de/System.Reflection.xml", - "ref/netcore50/es/System.Reflection.xml", - "ref/netcore50/fr/System.Reflection.xml", - "ref/netcore50/it/System.Reflection.xml", - "ref/netcore50/ja/System.Reflection.xml", - "ref/netcore50/ko/System.Reflection.xml", - "ref/netcore50/ru/System.Reflection.xml", - "ref/netcore50/zh-hans/System.Reflection.xml", - "ref/netcore50/zh-hant/System.Reflection.xml", - "ref/netstandard1.0/System.Reflection.dll", - "ref/netstandard1.0/System.Reflection.xml", - "ref/netstandard1.0/de/System.Reflection.xml", - "ref/netstandard1.0/es/System.Reflection.xml", - "ref/netstandard1.0/fr/System.Reflection.xml", - "ref/netstandard1.0/it/System.Reflection.xml", - "ref/netstandard1.0/ja/System.Reflection.xml", - "ref/netstandard1.0/ko/System.Reflection.xml", - "ref/netstandard1.0/ru/System.Reflection.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.xml", - "ref/netstandard1.3/System.Reflection.dll", - "ref/netstandard1.3/System.Reflection.xml", - "ref/netstandard1.3/de/System.Reflection.xml", - "ref/netstandard1.3/es/System.Reflection.xml", - "ref/netstandard1.3/fr/System.Reflection.xml", - "ref/netstandard1.3/it/System.Reflection.xml", - "ref/netstandard1.3/ja/System.Reflection.xml", - "ref/netstandard1.3/ko/System.Reflection.xml", - "ref/netstandard1.3/ru/System.Reflection.xml", - "ref/netstandard1.3/zh-hans/System.Reflection.xml", - "ref/netstandard1.3/zh-hant/System.Reflection.xml", - "ref/netstandard1.5/System.Reflection.dll", - "ref/netstandard1.5/System.Reflection.xml", - "ref/netstandard1.5/de/System.Reflection.xml", - "ref/netstandard1.5/es/System.Reflection.xml", - "ref/netstandard1.5/fr/System.Reflection.xml", - "ref/netstandard1.5/it/System.Reflection.xml", - "ref/netstandard1.5/ja/System.Reflection.xml", - "ref/netstandard1.5/ko/System.Reflection.xml", - "ref/netstandard1.5/ru/System.Reflection.xml", - "ref/netstandard1.5/zh-hans/System.Reflection.xml", - "ref/netstandard1.5/zh-hant/System.Reflection.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.reflection.4.3.0.nupkg.sha512", - "system.reflection.nuspec" - ] - }, - "System.Reflection.Primitives/4.3.0": { - "sha512": "5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", - "type": "package", - "path": "system.reflection.primitives/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Reflection.Primitives.dll", - "ref/netcore50/System.Reflection.Primitives.xml", - "ref/netcore50/de/System.Reflection.Primitives.xml", - "ref/netcore50/es/System.Reflection.Primitives.xml", - "ref/netcore50/fr/System.Reflection.Primitives.xml", - "ref/netcore50/it/System.Reflection.Primitives.xml", - "ref/netcore50/ja/System.Reflection.Primitives.xml", - "ref/netcore50/ko/System.Reflection.Primitives.xml", - "ref/netcore50/ru/System.Reflection.Primitives.xml", - "ref/netcore50/zh-hans/System.Reflection.Primitives.xml", - "ref/netcore50/zh-hant/System.Reflection.Primitives.xml", - "ref/netstandard1.0/System.Reflection.Primitives.dll", - "ref/netstandard1.0/System.Reflection.Primitives.xml", - "ref/netstandard1.0/de/System.Reflection.Primitives.xml", - "ref/netstandard1.0/es/System.Reflection.Primitives.xml", - "ref/netstandard1.0/fr/System.Reflection.Primitives.xml", - "ref/netstandard1.0/it/System.Reflection.Primitives.xml", - "ref/netstandard1.0/ja/System.Reflection.Primitives.xml", - "ref/netstandard1.0/ko/System.Reflection.Primitives.xml", - "ref/netstandard1.0/ru/System.Reflection.Primitives.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Primitives.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Primitives.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.reflection.primitives.4.3.0.nupkg.sha512", - "system.reflection.primitives.nuspec" - ] - }, - "System.Reflection.TypeExtensions/4.3.0": { - "sha512": "7u6ulLcZbyxB5Gq0nMkQttcdBTx57ibzw+4IOXEfR+sXYQoHvjW5LTLyNr8O22UIMrqYbchJQJnos4eooYzYJA==", - "type": "package", - "path": "system.reflection.typeextensions/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Reflection.TypeExtensions.dll", - "lib/net462/System.Reflection.TypeExtensions.dll", - "lib/netcore50/System.Reflection.TypeExtensions.dll", - "lib/netstandard1.5/System.Reflection.TypeExtensions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Reflection.TypeExtensions.dll", - "ref/net462/System.Reflection.TypeExtensions.dll", - "ref/netstandard1.3/System.Reflection.TypeExtensions.dll", - "ref/netstandard1.3/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/de/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/es/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/fr/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/it/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/ja/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/ko/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/ru/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/zh-hans/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/zh-hant/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/System.Reflection.TypeExtensions.dll", - "ref/netstandard1.5/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/de/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/es/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/fr/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/it/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/ja/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/ko/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/ru/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/zh-hans/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/zh-hant/System.Reflection.TypeExtensions.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Reflection.TypeExtensions.dll", - "system.reflection.typeextensions.4.3.0.nupkg.sha512", - "system.reflection.typeextensions.nuspec" - ] - }, - "System.Runtime/4.3.0": { - "sha512": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", - "type": "package", - "path": "system.runtime/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Runtime.dll", - "lib/portable-net45+win8+wp80+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Runtime.dll", - "ref/netcore50/System.Runtime.dll", - "ref/netcore50/System.Runtime.xml", - "ref/netcore50/de/System.Runtime.xml", - "ref/netcore50/es/System.Runtime.xml", - "ref/netcore50/fr/System.Runtime.xml", - "ref/netcore50/it/System.Runtime.xml", - "ref/netcore50/ja/System.Runtime.xml", - "ref/netcore50/ko/System.Runtime.xml", - "ref/netcore50/ru/System.Runtime.xml", - "ref/netcore50/zh-hans/System.Runtime.xml", - "ref/netcore50/zh-hant/System.Runtime.xml", - "ref/netstandard1.0/System.Runtime.dll", - "ref/netstandard1.0/System.Runtime.xml", - "ref/netstandard1.0/de/System.Runtime.xml", - "ref/netstandard1.0/es/System.Runtime.xml", - "ref/netstandard1.0/fr/System.Runtime.xml", - "ref/netstandard1.0/it/System.Runtime.xml", - "ref/netstandard1.0/ja/System.Runtime.xml", - "ref/netstandard1.0/ko/System.Runtime.xml", - "ref/netstandard1.0/ru/System.Runtime.xml", - "ref/netstandard1.0/zh-hans/System.Runtime.xml", - "ref/netstandard1.0/zh-hant/System.Runtime.xml", - "ref/netstandard1.2/System.Runtime.dll", - "ref/netstandard1.2/System.Runtime.xml", - "ref/netstandard1.2/de/System.Runtime.xml", - "ref/netstandard1.2/es/System.Runtime.xml", - "ref/netstandard1.2/fr/System.Runtime.xml", - "ref/netstandard1.2/it/System.Runtime.xml", - "ref/netstandard1.2/ja/System.Runtime.xml", - "ref/netstandard1.2/ko/System.Runtime.xml", - "ref/netstandard1.2/ru/System.Runtime.xml", - "ref/netstandard1.2/zh-hans/System.Runtime.xml", - "ref/netstandard1.2/zh-hant/System.Runtime.xml", - "ref/netstandard1.3/System.Runtime.dll", - "ref/netstandard1.3/System.Runtime.xml", - "ref/netstandard1.3/de/System.Runtime.xml", - "ref/netstandard1.3/es/System.Runtime.xml", - "ref/netstandard1.3/fr/System.Runtime.xml", - "ref/netstandard1.3/it/System.Runtime.xml", - "ref/netstandard1.3/ja/System.Runtime.xml", - "ref/netstandard1.3/ko/System.Runtime.xml", - "ref/netstandard1.3/ru/System.Runtime.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.xml", - "ref/netstandard1.5/System.Runtime.dll", - "ref/netstandard1.5/System.Runtime.xml", - "ref/netstandard1.5/de/System.Runtime.xml", - "ref/netstandard1.5/es/System.Runtime.xml", - "ref/netstandard1.5/fr/System.Runtime.xml", - "ref/netstandard1.5/it/System.Runtime.xml", - "ref/netstandard1.5/ja/System.Runtime.xml", - "ref/netstandard1.5/ko/System.Runtime.xml", - "ref/netstandard1.5/ru/System.Runtime.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.xml", - "ref/portable-net45+win8+wp80+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.runtime.4.3.0.nupkg.sha512", - "system.runtime.nuspec" - ] - }, - "System.Text.Encoding/4.3.0": { - "sha512": "BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", - "type": "package", - "path": "system.text.encoding/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Text.Encoding.dll", - "ref/netcore50/System.Text.Encoding.xml", - "ref/netcore50/de/System.Text.Encoding.xml", - "ref/netcore50/es/System.Text.Encoding.xml", - "ref/netcore50/fr/System.Text.Encoding.xml", - "ref/netcore50/it/System.Text.Encoding.xml", - "ref/netcore50/ja/System.Text.Encoding.xml", - "ref/netcore50/ko/System.Text.Encoding.xml", - "ref/netcore50/ru/System.Text.Encoding.xml", - "ref/netcore50/zh-hans/System.Text.Encoding.xml", - "ref/netcore50/zh-hant/System.Text.Encoding.xml", - "ref/netstandard1.0/System.Text.Encoding.dll", - "ref/netstandard1.0/System.Text.Encoding.xml", - "ref/netstandard1.0/de/System.Text.Encoding.xml", - "ref/netstandard1.0/es/System.Text.Encoding.xml", - "ref/netstandard1.0/fr/System.Text.Encoding.xml", - "ref/netstandard1.0/it/System.Text.Encoding.xml", - "ref/netstandard1.0/ja/System.Text.Encoding.xml", - "ref/netstandard1.0/ko/System.Text.Encoding.xml", - "ref/netstandard1.0/ru/System.Text.Encoding.xml", - "ref/netstandard1.0/zh-hans/System.Text.Encoding.xml", - "ref/netstandard1.0/zh-hant/System.Text.Encoding.xml", - "ref/netstandard1.3/System.Text.Encoding.dll", - "ref/netstandard1.3/System.Text.Encoding.xml", - "ref/netstandard1.3/de/System.Text.Encoding.xml", - "ref/netstandard1.3/es/System.Text.Encoding.xml", - "ref/netstandard1.3/fr/System.Text.Encoding.xml", - "ref/netstandard1.3/it/System.Text.Encoding.xml", - "ref/netstandard1.3/ja/System.Text.Encoding.xml", - "ref/netstandard1.3/ko/System.Text.Encoding.xml", - "ref/netstandard1.3/ru/System.Text.Encoding.xml", - "ref/netstandard1.3/zh-hans/System.Text.Encoding.xml", - "ref/netstandard1.3/zh-hant/System.Text.Encoding.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.text.encoding.4.3.0.nupkg.sha512", - "system.text.encoding.nuspec" - ] - }, - "System.Threading.Tasks/4.3.0": { - "sha512": "LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", - "type": "package", - "path": "system.threading.tasks/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Threading.Tasks.dll", - "ref/netcore50/System.Threading.Tasks.xml", - "ref/netcore50/de/System.Threading.Tasks.xml", - "ref/netcore50/es/System.Threading.Tasks.xml", - "ref/netcore50/fr/System.Threading.Tasks.xml", - "ref/netcore50/it/System.Threading.Tasks.xml", - "ref/netcore50/ja/System.Threading.Tasks.xml", - "ref/netcore50/ko/System.Threading.Tasks.xml", - "ref/netcore50/ru/System.Threading.Tasks.xml", - "ref/netcore50/zh-hans/System.Threading.Tasks.xml", - "ref/netcore50/zh-hant/System.Threading.Tasks.xml", - "ref/netstandard1.0/System.Threading.Tasks.dll", - "ref/netstandard1.0/System.Threading.Tasks.xml", - "ref/netstandard1.0/de/System.Threading.Tasks.xml", - "ref/netstandard1.0/es/System.Threading.Tasks.xml", - "ref/netstandard1.0/fr/System.Threading.Tasks.xml", - "ref/netstandard1.0/it/System.Threading.Tasks.xml", - "ref/netstandard1.0/ja/System.Threading.Tasks.xml", - "ref/netstandard1.0/ko/System.Threading.Tasks.xml", - "ref/netstandard1.0/ru/System.Threading.Tasks.xml", - "ref/netstandard1.0/zh-hans/System.Threading.Tasks.xml", - "ref/netstandard1.0/zh-hant/System.Threading.Tasks.xml", - "ref/netstandard1.3/System.Threading.Tasks.dll", - "ref/netstandard1.3/System.Threading.Tasks.xml", - "ref/netstandard1.3/de/System.Threading.Tasks.xml", - "ref/netstandard1.3/es/System.Threading.Tasks.xml", - "ref/netstandard1.3/fr/System.Threading.Tasks.xml", - "ref/netstandard1.3/it/System.Threading.Tasks.xml", - "ref/netstandard1.3/ja/System.Threading.Tasks.xml", - "ref/netstandard1.3/ko/System.Threading.Tasks.xml", - "ref/netstandard1.3/ru/System.Threading.Tasks.xml", - "ref/netstandard1.3/zh-hans/System.Threading.Tasks.xml", - "ref/netstandard1.3/zh-hant/System.Threading.Tasks.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.threading.tasks.4.3.0.nupkg.sha512", - "system.threading.tasks.nuspec" - ] - } - }, - "projectFileDependencyGroups": { - "net6.0": [ - "ConsoleTables >= 2.4.2" - ] - }, - "packageFolders": { - "/home/mrfluffy/.cache/NuGetPackages": {} - }, - "project": { - "version": "1.0.0", - "restore": { - "projectUniqueName": "/home/mrfluffy/Documents/c#/lpr381/lpr381.csproj", - "projectName": "lpr381", - "projectPath": "/home/mrfluffy/Documents/c#/lpr381/lpr381.csproj", - "packagesPath": "/home/mrfluffy/.cache/NuGetPackages", - "outputPath": "/home/mrfluffy/Documents/c#/lpr381/obj/", - "projectStyle": "PackageReference", - "configFilePaths": [ - "/home/mrfluffy/.nuget/NuGet/NuGet.Config" - ], - "originalTargetFrameworks": [ - "net6.0" - ], - "sources": { - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "net6.0": { - "targetAlias": "net6.0", - "projectReferences": {} - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - } - }, - "frameworks": { - "net6.0": { - "targetAlias": "net6.0", - "dependencies": { - "ConsoleTables": { - "target": "Package", - "version": "[2.4.2, )" - } - }, - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48" - ], - "assetTargetFallback": true, - "warn": true, - "downloadDependencies": [ - { - "name": "Microsoft.AspNetCore.App.Ref", - "version": "[6.0.6, 6.0.6]" - } - ], - "frameworkReferences": { - "Microsoft.NETCore.App": { - "privateAssets": "all" - } - }, - "runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/6.0.106/RuntimeIdentifierGraph.json" - } - } - } -} \ No newline at end of file diff --git a/obj/project.nuget.cache b/obj/project.nuget.cache deleted file mode 100644 index 2a874ae..0000000 --- a/obj/project.nuget.cache +++ /dev/null @@ -1,20 +0,0 @@ -{ - "version": 2, - "dgSpecHash": "UsG+n8no52tNULnArv36wfnSHuyNsJtVw+cLkcJKa4zAucFyRBa7qGlEyQpU5Roj2w954zGpsMoMYS9LaYexCw==", - "success": true, - "projectFilePath": "/home/mrfluffy/Documents/c#/lpr381/lpr381.csproj", - "expectedPackageFiles": [ - "/home/mrfluffy/.cache/NuGetPackages/consoletables/2.4.2/consoletables.2.4.2.nupkg.sha512", - "/home/mrfluffy/.cache/NuGetPackages/microsoft.netcore.platforms/1.1.0/microsoft.netcore.platforms.1.1.0.nupkg.sha512", - "/home/mrfluffy/.cache/NuGetPackages/microsoft.netcore.targets/1.1.0/microsoft.netcore.targets.1.1.0.nupkg.sha512", - "/home/mrfluffy/.cache/NuGetPackages/system.io/4.3.0/system.io.4.3.0.nupkg.sha512", - "/home/mrfluffy/.cache/NuGetPackages/system.reflection/4.3.0/system.reflection.4.3.0.nupkg.sha512", - "/home/mrfluffy/.cache/NuGetPackages/system.reflection.primitives/4.3.0/system.reflection.primitives.4.3.0.nupkg.sha512", - "/home/mrfluffy/.cache/NuGetPackages/system.reflection.typeextensions/4.3.0/system.reflection.typeextensions.4.3.0.nupkg.sha512", - "/home/mrfluffy/.cache/NuGetPackages/system.runtime/4.3.0/system.runtime.4.3.0.nupkg.sha512", - "/home/mrfluffy/.cache/NuGetPackages/system.text.encoding/4.3.0/system.text.encoding.4.3.0.nupkg.sha512", - "/home/mrfluffy/.cache/NuGetPackages/system.threading.tasks/4.3.0/system.threading.tasks.4.3.0.nupkg.sha512", - "/home/mrfluffy/.cache/NuGetPackages/microsoft.aspnetcore.app.ref/6.0.6/microsoft.aspnetcore.app.ref.6.0.6.nupkg.sha512" - ], - "logs": [] -} \ No newline at end of file diff --git a/simplex.cs b/simplex.cs deleted file mode 100644 index c102b21..0000000 --- a/simplex.cs +++ /dev/null @@ -1,249 +0,0 @@ -using ConsoleTables; -class simplex -{ - public void simplexAlgo() - { - file file = new file(); - Tuple, List> content = file.readFile(); - List zConstraintsList = content.Item1; - List constraintsList = content.Item2; - - // print constraintsList - foreach (zConstraints constraints in zConstraintsList) - { - Console.WriteLine(constraints.minMax + " " + string.Join(" ", constraints.values)); - } - foreach (Constraints constraints in constraintsList) - { - Console.WriteLine(constraints.sign + " " + string.Join(" ", constraints.values)); - } - List> table = new List>(); - table.Add(zConstraintsList[0].values); - // add all constraints in constraintsList to table - foreach (Constraints constraints in constraintsList) - { - table.Add(constraints.values); - } - List> newTable = new List>(); - // add all rows in table to newTable - foreach (List row in table) - { - // add all columns in row to newTable without reference to table - List newRow = new List(); - for (int i = 0; i < row.Count; i++) - { - newRow.Add(row[i]); - - } - newTable.Add(newRow); - } - - // add s variable to table - for (int i = 0; i < table.Count; i++) - { - if (i == 0) - { - for (int j = 0; j < table[i].Count + 1; j++) - { - newTable[i].Add(0); - } - } - else - { - for (int j = 0; j < table[i].Count-1; j++) - { - //save the last value in newTable in to lastVal and remove it from newTanle - float lastVal = newTable[i][newTable[i].Count - 1]; - newTable[i].RemoveAt(newTable[i].Count - 1); - if (i == j+1) - { - newTable[i].Add(1); - } - else - { - newTable[i].Add(0); - } - newTable[i].Add(lastVal); - } - } - } - // print table - printTable(newTable); - bool optimal = false; - newTable = flipZ(newTable); - while (!optimal) - { - int pivotCol = findPivotCol(newTable); - List ratio = ratioTest(newTable, pivotCol); - int pivotRow = findPivotRow(ratio); - printTable(newTable); - newTable = pivotTable(newTable, pivotRow, pivotCol); - Console.WriteLine(""); - if (checkOptimal(newTable)) - { - printTable(newTable); - optimal = true; - } - } - - } - - - static void printTable(List> newTable) - { - string[] headers = new string[newTable[0].Count]; - double half = newTable[0].Count / 2; - int halfInt = (int)Math.Floor(half); - for (int i = 0; i < newTable[0].Count; i++) - { - if (i != newTable[0].Count - 1 && i < halfInt) - { - headers[i] = "x" + (i + 1); - } - else if (i != newTable[0].Count - 1 && i >= halfInt) - { - // add "s" to headers starting at 1 - headers[i] = "s" + ((i - newTable[0].Count / 2)+1); - //headers[i] = "s" + (i + 1); - } - else - { - headers[i] = "rhs"; - } - } - var conTable = new ConsoleTable(headers); - // for each row in table add row to conTable - foreach (List row in newTable) - { - // convert row to object array - object[] rowArray = new object[row.Count]; - for (int i = 0; i < row.Count; i++) - { - rowArray[i] = row[i]; - } - conTable.AddRow(rowArray); - } - conTable.Write(Format.Alternative); - } - - - - static bool checkOptimal(List> table) - { - int zIndex = 0; - for (int i = 0; i < table[0].Count; i++) - { - if (table[0][i] < 0) - { - zIndex = i; - } - } - if (zIndex == 0) - { - return true; - } - else - { - return false; - } - } - - - static List> flipZ(List> table) - { - for (int i = 0; i < table[0].Count; i++) - { - if (table[0][i] > 0) - { - table[0][i] = -table[0][i]; - } - } - return table; - } - - static int findPivotCol(List> table) - { - float largest = 0; - int largestIndex = 0; - for (int i = 0; i < table[0].Count; i++) - { - if (table[0][i] < largest) - { - largest = table[0][i]; - largestIndex = i; - } - } - return largestIndex; - } - - static List ratioTest(List> table, int testCol) - { - List ratios = new List(); - for (int i = 1; i < table.Count; i++) - { - if (table[i][testCol] != 0) - { - ratios.Add(table[i][table[i].Count - 1] / table[i][testCol]); - } - else - { - ratios.Add(float.MaxValue); - } - } - return ratios; - } - - - static int findPivotRow(List ratios) - { - float smallest = float.MaxValue; - int smallestIndex = 0; - for (int i = 0; i < ratios.Count; i++) - { - if (ratios[i] < smallest && ratios[i] > 0.0) - { - smallest = ratios[i]; - smallestIndex = i; - } - } - return smallestIndex; - } - - - static List> pivotTable(List> table, int pivotRow, int pivotCol) - { - //clone table in to newTable - List> newTable = new List>(); - foreach (List row in table) - { - List newRow = new List(); - for (int i = 0; i < row.Count; i++) - { - newRow.Add(row[i]); - } - newTable.Add(newRow); - } - var pivotPoint = newTable[pivotRow + 1][pivotCol]; - // divide pivot row by pivot point - for (int i = 0; i < newTable[pivotRow + 1].Count; i++) - { - newTable[pivotRow + 1][i] = newTable[pivotRow + 1][i] / pivotPoint; - } - // current possition-(pivot_row*new_table pivot_point) - for (int i = 0; i < newTable.Count; i++) - { - if (i != pivotRow + 1) - { - var currentPossition = newTable[i][pivotCol]; - for (int j = 0; j < newTable[i].Count; j++) - { - newTable[i][j] = newTable[i][j] - (currentPossition * newTable[pivotRow + 1][j]); - } - } - } - return newTable; - - } - -} - diff --git a/twoPhaseSimplex.cs b/twoPhaseSimplex.cs deleted file mode 100644 index 8f2bd01..0000000 --- a/twoPhaseSimplex.cs +++ /dev/null @@ -1,432 +0,0 @@ -using ConsoleTables; -class twoPhaseSimplex -{ - public void twoPhaseSimplexAlgo() - { - file file = new file(); - Tuple, List> content = file.readFile(); - List zConstraintsList = content.Item1; - List constraintsList = content.Item2; - - // print constraintsList - foreach (zConstraints constraints in zConstraintsList) - { - Console.WriteLine(constraints.minMax + " " + string.Join(" ", constraints.values)); - } - foreach (Constraints constraints in constraintsList) - { - Console.WriteLine(constraints.sign + " " + string.Join(" ", constraints.values)); - } - List> table = new List>(); - table.Add(zConstraintsList[0].values); - // add all constraints in constraintsList to table - foreach (Constraints constraints in constraintsList) - { - table.Add(constraints.values); - } - List> newTable = new List>(); - // add all rows in table to newTable - foreach (List row in table) - { - // add all columns in row to newTable without reference to table - List newRow = new List(); - for (int i = 0; i < row.Count; i++) - { - newRow.Add(row[i]); - - } - newTable.Add(newRow); - } - int varCount = newTable[0].Count; - table = prepareTable(newTable, constraintsList); - - // print table - printTablePhaseOne(table, varCount); - - flipZ(table); - printTablePhaseOne(table, varCount); - bool isOptimal = isOptimalPhaseOne(table); - while (!isOptimal) - { - int pivotCol = findPivotCol(table); - List ratio = ratioTest(table, pivotCol); - int pivotRow = findPivotRow(ratio); - table = pivotTable(table, pivotRow, pivotCol); - printTablePhaseOne(table, varCount); - isOptimal = isOptimalPhaseOne(table); - } - - table = dropCol(table, varCount); - isOptimal = isOptimalPhaseTwo(table); - printTablePhaseTwo(table, varCount); - while (!isOptimal) - { - int pivotCol = findPivotCol(table); - List ratio = ratioTest(table, pivotCol); - int pivotRow = findPivotRow(ratio); - table = pivotTable(table, pivotRow, pivotCol); - printTablePhaseTwo(table, varCount); - isOptimal = isOptimalPhaseTwo(table); - } - - - - - } - - void printTablePhaseOne(List> table, int varCount) - { - int count = 1; - string[] headers = new string[table[0].Count]; - for (int i = 0; i < table[0].Count; i++) - { - if (i < varCount) - { - headers[i] = "x" + (i + 1); - } - else if (i < table[0].Count - 1) - { - headers[i] = "e" + (count); - headers[i+1] = "a" + (count); - headers[i+2] = "s" + (count); - i = i + 2; - count++; - } - else - { - headers[i] = "rhs"; - } - } - var conTable = new ConsoleTable(headers); - foreach (List row in table) - { - // convert row to object array - object[] rowArray = new object[row.Count]; - for (int i = 0; i < row.Count; i++) - { - rowArray[i] = row[i]; - } - conTable.AddRow(rowArray); - } - conTable.Write(Format.Alternative); - - } - - void printTablePhaseTwo(List> table, int varCount) - { - int count = 1; - string[] headers = new string[table[0].Count]; - for (int i = 0; i < table[0].Count; i++) - { - if (i < varCount) - { - headers[i] = "x" + (i + 1); - } - else if (i < table[0].Count - 1) - { - headers[i] = "e" + (count); - headers[i+1] = "s" + (count); - i = i + 1; - count++; - } - else - { - headers[i] = "rhs"; - } - } - var conTable = new ConsoleTable(headers); - foreach (List row in table) - { - // convert row to object array - object[] rowArray = new object[row.Count]; - for (int i = 0; i < row.Count; i++) - { - rowArray[i] = row[i]; - } - conTable.AddRow(rowArray); - } - conTable.Write(Format.Alternative); - - } - - List> prepareTable(List> table, List constraints) - { - // save all values in table in to newTable - List> newTable = new List>(); - foreach (List row in table) - { - List newRow = new List(); - foreach (float value in row) - { - newRow.Add(value); - } - newTable.Add(newRow); - } - List rowsWithW = new List(); - List signs = new List(); - foreach (Constraints constraint in constraints) - { - signs.Add(constraint.sign); - } - // ammount of values in newTable startring from newTable[1]) - int varCount = 0; - for (int i = 1; i < newTable.Count; i++) - { - varCount = varCount + newTable[i].Count; - } - for (int i = 0; i < signs.Count ; i++) - { - table[0].Add(0); - table[0].Add(0); - table[0].Add(0); - int temp = (newTable[i+1].Count-1) * signs.Count; - - - // add 3 0s to each row for every column in table - for (int j = 0; j < signs.Count ; j++) - { - if (signs[i] == ">=") - { - // make s = 1 - if (i == j) - { - table[i+1].Add(0); - table[i+1].Add(0); - table[i+1].Add(1); - } - else - { - table[i+1].Add(0); - table[i+1].Add(0); - table[i+1].Add(0); - } - } - else if (signs[i] == "<=") - { - //make e and a = 1 - if (i == j) - { - table[i+1].Add(-1); - table[i+1].Add(1); - table[i+1].Add(0); - rowsWithW.Add(i+1); - } - else - { - table[i+1].Add(0); - table[i+1].Add(0); - table[i+1].Add(0); - } - } - else if (signs[i] == "=") - { - // make a = 1 - if (i == j) - { - table[i+1].Add(0); - table[i+1].Add(1); - table[i+1].Add(0); - rowsWithW.Add(i+1); - } - else - { - table[i+1].Add(0); - table[i+1].Add(0); - table[i+1].Add(0); - } - } - } - } - table[0].Add(0); - // create list of floats called wRow size table[0].Count - 1 - List wRow = new List(); - for (int i = 0; i < table[0].Count; i++) - { - wRow.Add(0); - } - for (int i = 0; i < table[0].Count; i++) - { - // if i is in rowsWithW - if (rowsWithW.Contains(i)) - { - for (int j = 0; j < wRow.Count; j++) - { - wRow[j] = wRow[j] + (-table[i][j]); - } - } - } - //add wRow to the start of table - table.Insert(1, wRow); - - // remove intex newTable.Count-1 from table and place it in the back of table - for (int i = 2; i < table.Count; i++) - { - table[i].RemoveAt(newTable.Count-1); - table[i].Add(newTable[i-1][newTable[i-1].Count-1]); - - } - // remove the value of newTable.Count-1 from table[1] and place it in the back of table[1] - float lastValue = table[1][newTable.Count-1]; - table[1].RemoveAt(newTable.Count-1); - table[1].Add(lastValue); - - - - return table; - } - static List> flipZ(List> table) - { - for (int i = 0; i < table[0].Count; i++) - { - if (table[0][i] > 0) - { - table[0][i] = -table[0][i]; - } - } - return table; - } - - static int findPivotCol(List> table) - { - float largest = 0; - int largestIndex = 0; - for (int i = 0; i < table[0].Count; i++) - { - if (table[0][i] < largest) - { - largest = table[0][i]; - largestIndex = i; - } - } - return largestIndex; - } - - static List ratioTest(List> table, int testCol) - { - List ratios = new List(); - for (int i = 1; i < table.Count; i++) - { - if (table[i][testCol] != 0) - { - ratios.Add(table[i][table[i].Count - 1] / table[i][testCol]); - } - else - { - ratios.Add(float.MaxValue); - } - } - return ratios; - } - static int findPivotRow(List ratios) - { - float smallest = float.MaxValue; - int smallestIndex = 0; - for (int i = 0; i < ratios.Count; i++) - { - if (ratios[i] < smallest && ratios[i] > 0.0) - { - smallest = ratios[i]; - smallestIndex = i; - } - } - return smallestIndex; - } - - static List> pivotTable(List> table, int pivotRow, int pivotCol) - { - //clone table in to newTable - List> newTable = new List>(); - foreach (List row in table) - { - List newRow = new List(); - for (int i = 0; i < row.Count; i++) - { - newRow.Add(row[i]); - } - newTable.Add(newRow); - } - var pivotPoint = newTable[pivotRow + 1][pivotCol]; - // divide pivot row by pivot point - for (int i = 0; i < newTable[pivotRow + 1].Count; i++) - { - newTable[pivotRow + 1][i] = newTable[pivotRow + 1][i] / pivotPoint; - } - // current possition-(pivot_row*new_table pivot_point) - for (int i = 0; i < newTable.Count; i++) - { - if (i != pivotRow + 1) - { - var currentPossition = newTable[i][pivotCol]; - for (int j = 0; j < newTable[i].Count; j++) - { - newTable[i][j] = newTable[i][j] - (currentPossition * newTable[pivotRow + 1][j]); - } - } - } - return newTable; - } - - //check if the table is optimal first phase - // table is optimal if all values in table[1] are positive - - - static bool isOptimalPhaseOne(List> table) - { - int wIndex = 0; - for (int i = 0; i < table[1].Count; i++) - { - if (table[1][i] < 0) - { - wIndex = i; - } - } - if (wIndex == 0) - { - return true; - } - else - { - return false; - } - } - - - static bool isOptimalPhaseTwo(List> table) - { - int wIndex = 0; - for (int i = 0; i < table[0].Count; i++) - { - if (table[0][i] < 0) - { - wIndex = i; - } - } - if (wIndex == 0) - { - return true; - } - else - { - return false; - } - } - - - //drop all a coloumn from the table and drop w row from the table - static List> dropCol(List> table, int varCount) - { - table.RemoveAt(1); - - - // for each row in table drop the varCount-1th element - for (int i = 0; i < table.Count; i++) - { - for (int j = varCount + 1; j < table[i].Count - 1; j+=3) - { - table[i].RemoveAt(j); - j = j - 1; - } - } - return table; - } -} \ No newline at end of file