Пример #1
0
        private static double testOptimMaxruntimeTermination(double threshold, double hours, double objCalcPauseSec, double expectedMaxSeconds, TestObjEval <TestHyperCube> innerObjCalc = null)
        {
            var engine = createSce(threshold, hours, objCalcPauseSec, innerObjCalc);
            var deltaT = timeOptimizer(engine);

            //Console.WriteLine("Current shuffle: {0}", engine.CurrentShuffle);
            Assert.IsTrue(deltaT < expectedMaxSeconds);
            return(deltaT);
        }
Пример #2
0
        private static ShuffledComplexEvolution <TestHyperCube> createSce(double cvThreshold, double maxHours, double objCalcPauseSec, TestObjEval <TestHyperCube> innerObjCalc = null, int maxShuffle = 15)
        {
            var termination = new ShuffledComplexEvolution <TestHyperCube> .CoefficientOfVariationTerminationCondition(threshold : cvThreshold, maxHours : maxHours);

            var rng = new BasicRngFactory(0);

            if (innerObjCalc == null)
            {
                innerObjCalc = new ParaboloidObjEval <TestHyperCube>(bestParam: 2);
            }
            var evaluator = new ObjEvalTestHyperCube(innerObjCalc, pauseSeconds: objCalcPauseSec);
            var engine    = createSce(termination, rng, evaluator, maxShuffle: maxShuffle);

            return(engine);
        }
Пример #3
0
 public ObjEvalTestHyperCube(TestObjEval <TestHyperCube> innerObjCalc, double pauseSeconds = 0.0)
 {
     this.pauseSeconds = pauseSeconds;
     this.innerObjCalc = innerObjCalc;
 }