Beispiel #1
0
        static void Main(string[] args)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                StreamReader sr      = new StreamReader(ofd.FileName);
                string       optFile = sr.ReadToEnd();
                sr.Close();

                Optimizer op = Optimizer.DeSerialize(optFile);
                op.setDecisions();
                op.addDefaultConstraint();
                op.setObjectiveFormula();
                op.addLimitConstraints();
                op.addAllConstraints(new string[] { "DM", "CP", "RUP", "CF", "EE", "ADF", "NDF", "eNDF", "TDNCattle", "TDNSheep", "DESheep", "MECattle", "MESheep", "NEmCattle", "NEgCattle", "NElCattle", "MEPoultry", "DEHorse", "DEPig", "MEPig", "Arg", "His", "Iso_L", "Leu", "Lys", "Met", "Cys", "Phe", "Tyr", "Thr", "Trp", "Val", "Gly", "Ser", "Ca", "Cl", "Mg", "P", "K", "Na", "S", "Co", "Cu", "I", "Fe", "Mn", "Se", "Zn", "VitA", "VitD", "VitE", "VitK", "Biotin", "Choline", "Folic", "Niacin", "Pantot", "VitB2", "VitB1", "VitB6", "VitB12" });
                op.getResults();
                Console.WriteLine(op.GetOptimalCost());
                Console.ReadLine();
            }
            else
            {
                MessageBox.Show("No file select.");
            }
        }