private LChain buildLChain(VengerMatrix c, int i, int j) { LChain chain = new LChain(c.N * c.N); chain.add(i, j); while ((i = c.hasMarkedElementInColumn(j, '*')) != -1) { chain.add(i, j); j = c.hasMarkedElementInRow(i, '\''); chain.add(i, j); } return chain; }
/// <summary> /// Построение первоначальной СНН /// </summary> /// <param name="c"></param> private void buildInitialINS(ref VengerMatrix c) { c.K = 0; for (int j = 0; j < c.N; j++) for (int i = 0; i < c.N; i++) if (c.get(i, j) == 0.0 && (c.hasMarkedElementInRow(i, '*') == -1)) { c.markElement(i, j, '*'); c.K++; break; } }