Пример #1
0
        private static List <SpreadSheetExample> ReadFromFile()
        {
            var largeExamples = new List <SpreadSheetExample>();

            var spreadsheet     = new ExcelSpreadSheet();
            var outPutDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
            var iconPath        = Path.Combine(outPutDirectory, @"QuadraticProgramming2.xlsx");


            var book = spreadsheet.GetExcelWorkBook(iconPath);

            {
                var vectors  = spreadsheet.ReadRange(book, "QP_Raw50", "BasisVectors");
                var target2d = spreadsheet.ReadRange(book, "QP_Raw50", "TargetProfile");
                var target   = FlattenArray(target2d);

                largeExamples.Add(new SpreadSheetExample()
                {
                    Name            = "QP_Soln50: 50 Vector problem",
                    BasisVectors    = vectors,
                    TargetVector    = target,
                    LowerConstraint = 0,
                    UpperConstraint = 2,
                });
            }

            {
                var vectors  = spreadsheet.ReadRange(book, "QP_Raw300", "BasisVectors");
                var target2d = spreadsheet.ReadRange(book, "QP_Raw300", "TargetProfile");
                var target   = FlattenArray(target2d);

                largeExamples.Add(new SpreadSheetExample()
                {
                    Name            = "QP_Soln300: 300 Vector problem",
                    BasisVectors    = vectors,
                    TargetVector    = target,
                    LowerConstraint = 0,
                    UpperConstraint = 20,
                });
            }

            GC.Collect();
            GC.WaitForPendingFinalizers();

            return(largeExamples);
        }
Пример #2
0
        private static List<SpreadSheetExample> ReadFromFile()
        {
            var largeExamples = new List<SpreadSheetExample>();

            var spreadsheet = new ExcelSpreadSheet();
            var outPutDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
            var iconPath = Path.Combine(outPutDirectory, @"QuadraticProgramming2.xlsx");


            var book = spreadsheet.GetExcelWorkBook(iconPath);

            {
                var vectors = spreadsheet.ReadRange(book, "QP_Raw50", "BasisVectors");
                var target2d = spreadsheet.ReadRange(book, "QP_Raw50", "TargetProfile");
                var target = FlattenArray(target2d);

                largeExamples.Add(new SpreadSheetExample()
                {
                    Name = "QP_Soln50: 50 Vector problem",
                    BasisVectors = vectors,
                    TargetVector = target,
                    LowerConstraint = 0,
                    UpperConstraint = 2,
                });
            }

            {
                var vectors = spreadsheet.ReadRange(book, "QP_Raw300", "BasisVectors");
                var target2d = spreadsheet.ReadRange(book, "QP_Raw300", "TargetProfile");
                var target = FlattenArray(target2d);

                largeExamples.Add(new SpreadSheetExample()
                {
                    Name = "QP_Soln300: 300 Vector problem",
                    BasisVectors = vectors,
                    TargetVector = target,
                    LowerConstraint = 0,
                    UpperConstraint = 20,
                });
            }

            GC.Collect();
            GC.WaitForPendingFinalizers();

            return largeExamples;
        }