|
@@ -108,11 +108,39 @@ namespace MinElKuzminEkz
|
|
|
}
|
|
|
|
|
|
//класс utility
|
|
|
- internal class Utility
|
|
|
+ public static class Utility
|
|
|
{
|
|
|
+ public static bool CheckClosure(int[] a, int[] b)
|
|
|
+ {
|
|
|
+ int sum_a = a.Sum();
|
|
|
+ int sum_b = b.Sum();
|
|
|
+ Debug.WriteLine($"Проверка на закрытость задачи: A = {sum_a}, B = {sum_b}");
|
|
|
+ return sum_a == sum_b;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static bool CheckIfVyrozhdeno(int[,] supply_plan)
|
|
|
+ {
|
|
|
+ int n = supply_plan.GetLength(0);
|
|
|
+ int m = supply_plan.GetLength(1);
|
|
|
+
|
|
|
+ int kolvo_polozh_komponent = 0;
|
|
|
+ for (int i = 0; i < n; i++)
|
|
|
+ {
|
|
|
+ for (int j = 0; j < m; j++)
|
|
|
+ {
|
|
|
+ if (supply_plan[i, j] > 0)
|
|
|
+ {
|
|
|
+ kolvo_polozh_komponent++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Debug.WriteLine($"Проверка вырожденности A = {kolvo_polozh_komponent}, B = {n + m - 1}");
|
|
|
+ return kolvo_polozh_komponent != n + m - 1;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|