Exemplo n.º 1
0
 public static void ExampleGenIt15()
 {
     //[3 0 7 0 5 0 5 0]
     Matrix a = MatrixGenerator.From(
         new double[,]{{4,3,2,-1},
                       {1,-2,-5,-3}});
     Matrix b = MatrixGenerator.From(new double[,] { { 7, -12 } }).Transpose();
     Matrix c = MatrixGenerator.From(new double[,] { { 3,7,6,5} }).Transpose();
     Matrix xBase = MatrixGenerator.From(new double[,] { { 0, 0, 0, 0 } }).Transpose();
     List<int> baseIndexes = new List<int>(new[] { 0, 0 });
     var sm = new SimplexMethodGeneralIteration(a, b, c, xBase, baseIndexes);
     Matrix ans = null;
     bool isSolved = sm.SolveWithoutXBase(out ans);
     Console.WriteLine("IsSolved: {0}\nSolution:\n{1}", isSolved, isSolved ? ans.ToString() : "");
 }
Exemplo n.º 2
0
 //on Lab Ex. 5.139 with modification
 public static void ExampleGenIt13()
 {
     Matrix a = MatrixGenerator.From(
         new double[,]{{0,3,1,0,1,3,1,5},
                       {1,6,0,0,2,3,2,5},
                       {1,4,2,-2,0,5,2,11},
                       {1,2,2,2,2,7,0,7}});
     Matrix b = MatrixGenerator.From(new double[,] { { 17, 23, 27, 27 } }).Transpose();
     Matrix c = MatrixGenerator.From(new double[,] { { 1, 2, 1, -2, 1, 2, 1, -2 } }).Transpose();
     Matrix xBase = MatrixGenerator.From(new double[,] { { 0, 2, 0, 1, 0, 2, 0, 1 } }).Transpose();
     List<int> baseIndexes = new List<int>(new[] { 1, 3, 5, 7 });
     var sm = new SimplexMethodGeneralIteration(a, b, c, xBase, baseIndexes);
     Matrix ans = null;
     bool isSolved = sm.SolveWithoutXBase(out ans);
     Console.WriteLine("IsSolved: {0}\nSolution:\n{1}", isSolved, isSolved ? ans.ToString() : "");
 }