コード例 #1
0
        static void Main(string[] args)
        {
            ObjectiveFunction objF = new ObjectiveFunction(new double[6] {
                5, 4, 3,
                2, 3, 1
            });

            Constraint c1 = new Constraint(new double[6] {
                1, 1, 1,
                0, 0, 0
            }, 10);

            Constraint c2 = new Constraint(new double[6] {
                0, 0, 0,
                1, 1, 1
            }, 15);

            Constraint c3 = new Constraint(new double[6] {
                1, 0, 0,
                1, 0, 0
            }, 10);

            Constraint c4 = new Constraint(new double[6] {
                0, 1, 0,
                0, 1, 0
            }, 5);

            Constraint c5 = new Constraint(new double[6] {
                0, 0, 1,
                0, 0, 1
            }, 5);

            LPP lpp = new LPP(objF, new Constraint[5] {
                c1, c2, c3, c4, c5
            });

            lpp.Solve();

            //Solver solver = new Solver();
            //solver.LowBound = 1;
            //solver.HighBound = 100;
            //solver.Accuracy = 0.01;
            //solver.FuncCoefs = new double[5] { c1, c2, c3, c4, c5 };
            //solver.VarPows = new double[5] { 0, -0.336, -1.429, -1.054, -0.695 };

            //Console.WriteLine((int)solver.Solve());

            //try { Console.WriteLine(s.Solve()); }
            //catch (Exception e) { Console.WriteLine(e.Message); }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: imsosharp/leagueplusplus
 internal static void onGameLoad(EventArgs args)
 {
     // C++ DLL Skill Handler
     LPP.onGame();
     // C++ DLL Menu Handler
     LPP.onGameLoadMenu();
     // C++ DLL Game Logic
     Game.OnGameUpdate += LPP.onGameUpdate;
     // C++ DLL Gap Closer Logic
     AntiGapcloser.OnEnemyGapcloser += LPP.onEnemyGapCloser;
     // C++ DLL Interrupter Logic
     Interrupter.OnPossibleToInterrupt += LPP.onPossibleToInterrupt;
     // C++ DLL Spell cast logic
     Obj_AI_Hero.OnProcessSpellCast += LPP.onProcessSpellCast;
     // C++ DLL Drawings
     Drawing.OnDraw += LPP.onDraw;
 }
コード例 #3
0
        public void SimulateTS()
        {
            double[] sc = new double[4];
            while (sc[0] <= 0 || double.IsPositiveInfinity(sc[0]))
            {
                sc = simplexCoeffs();
            }
            MessageBox.Show(sc[0].ToString() + " : " + sc[1].ToString() + " : " + sc[3].ToString());

            ObjectiveFunction objF = new ObjectiveFunction(sc);
            Constraint        c1   = new Constraint(new double[4] {
                1, 1, 1, 1
            }, 1);
            Constraint c2 = new Constraint(new double[4] {
                -1, -1, -1, -1
            }, -1);
            Constraint c3 = new Constraint(new double[4] {
                -1, 0, 0, 0
            }, -0.1);
            Constraint c4 = new Constraint(new double[4] {
                0, -1, 0, 0
            }, -0.1);
            Constraint c5 = new Constraint(new double[4] {
                0, 0, -1, 0
            }, -0.1);
            Constraint c6 = new Constraint(new double[4] {
                0, 0, 0, -1
            }, -0.1);
            LPP lpp = new LPP(objF, new Constraint[6] {
                c1, c2, c3, c4, c5, c6
            });

            lpp.Solve();

            //MessageBox.Show(lpp.Variables[0].ToString() + " : " + lpp.Variables[1].ToString() + " : " +
            //                lpp.Variables[2].ToString() + " : " + lpp.Variables[3].ToString());
        }
コード例 #4
0
        /// <summary>
        /// Имитация процесса функционирования ПЖДТ
        /// </summary>
        /// <returns>значение целевой функции, характеризующей устойчивое развитие ПЖДТ</returns>
        public double SimulateTS()
        {
            double[] sc = new double[4];
            while (sc[0] <= 0 || double.IsPositiveInfinity(sc[0]))
            {
                sc = simplexCoeffs();
            }

            ObjectiveFunction objF = new ObjectiveFunction(sc);
            Constraint        c1   = new Constraint(new double[4] {
                1, 1, 1, 1
            }, 1);
            Constraint c2 = new Constraint(new double[4] {
                -1, -1, -1, -1
            }, -1);
            Constraint c3 = new Constraint(new double[4] {
                -1, 0, 0, 0
            }, -0.1);
            Constraint c4 = new Constraint(new double[4] {
                0, -1, 0, 0
            }, -0.1);
            Constraint c5 = new Constraint(new double[4] {
                0, 0, -1, 0
            }, -0.1);
            Constraint c6 = new Constraint(new double[4] {
                0, 0, 0, -1
            }, -0.1);
            LPP lpp = new LPP(objF, new Constraint[6] {
                c1, c2, c3, c4, c5, c6
            });

            lpp.Solve();
            //MessageBox.Show(lpp.ObjFunc.Value(lpp.Variables).ToString(), "Response Function");

            return(lpp.ObjFunc.Value(lpp.Variables));
        }