public void Evaluate(ICandidate candidate)
        {
            // use starting _ for PascalCase conversion purposes
            EvaluationDelegate _evaluation = GetEvaluationDelegate();

            _evaluation(candidate);
        }
示例#2
0
 /** Constructor */
 public BehaviorNodeConditional(BehaviorNode ifTrue, BehaviorNode ifFalse, EvaluationDelegate eval, String name, bool debugPrint)
 {
     _ifTrue     = ifTrue;
     _ifFalse    = ifFalse;
     _eval       = eval;
     _debugPrint = debugPrint;
     _name       = name;
 }
示例#3
0
 public GeneticAlgorithm(int populationSize, int chromosomeLength, int numberOfGenerations, double crossoverRate, double mutationRate, EvaluationDelegate fitnessFunction, BoundPair[] genesDomain, int elitismFactor = 0, SelectionMode Selection = SelectionMode.RouletteWheel, bool PrintLogMode = false)
 {
     this.populationSize      = populationSize;
     this.chromosomeLength    = chromosomeLength;
     this.numberOfGenerations = numberOfGenerations;
     this.crossoverRate       = crossoverRate;
     this.mutationRate        = mutationRate;
     this.fitnessFunction     = fitnessFunction;
     this.genesDomain         = genesDomain;
     this.elitismFactor       = elitismFactor;
     this.PrintLogMode        = PrintLogMode;
 }
示例#4
0
 private void RunEvaluationDelegateTest(EvaluationDelegate evaluation)
 {
     var q1 = NewQuery();
     var cq1 = q1;
     q1.Constrain(GetType());
     cq1 = cq1.Descend("child");
     cq1.Constrain(evaluation);
     var os = q1.Execute();
     Assert.AreEqual(1, os.Count);
     var se = (CsEvaluationDelegate) os.Next();
     Assert.AreEqual("two", se.name);
 }
 public GeneticAlgorithm(int populationSize, int chromosomeLength, int numberOfGenerations, double crossoverRate, double mutationRate, EvaluationDelegate fitnessFunction, BoundPair[] genesDomain ,  int elitismFactor = 0, SelectionMode Selection = SelectionMode.RouletteWheel, bool PrintLogMode = false)
 {
     this.populationSize = populationSize;
     this.chromosomeLength = chromosomeLength;
     this.numberOfGenerations = numberOfGenerations;
     this.crossoverRate = crossoverRate;
     this.mutationRate = mutationRate;
     this.fitnessFunction = fitnessFunction;
     this.genesDomain = genesDomain;
     this.elitismFactor = elitismFactor;
     this.PrintLogMode = PrintLogMode;
 }
示例#6
0
 void RunEvaluationDelegateTest(EvaluationDelegate evaluation)
 {
     IQuery q1 = NewQuery();
     IQuery cq1 = q1;
     q1.Constrain(GetType());
     cq1 = cq1.Descend("child");
     cq1.Constrain(evaluation);
     IObjectSet os = q1.Execute();
     Assert.AreEqual(1, os.Count);
     CsEvaluationDelegate se = (CsEvaluationDelegate)os.Next();
     Assert.AreEqual("two", se.name);
 }
示例#7
0
        static PythonEngine()
        {
            Evaluator = delegate(bool dirty, string script, IEnumerable<Binding> bindings)
            {
                if (dirty)
                {
                    engine.ProcessCode(script);
                    dirty = false;
                }

                return engine.Evaluate(PythonBindings.Bindings.Concat(bindings));
            };

            Drawing = delegate(FScheme.Value val, RenderDescription rd) { };
        }
        void RunEvaluationDelegateTest(EvaluationDelegate evaluation)
        {
            IQuery q1  = NewQuery();
            IQuery cq1 = q1;

            q1.Constrain(GetType());
            cq1 = cq1.Descend("child");
            cq1.Constrain(evaluation);
            IObjectSet os = q1.Execute();

            Assert.AreEqual(1, os.Count);
            CsEvaluationDelegate se = (CsEvaluationDelegate)os.Next();

            Assert.AreEqual("two", se.name);
        }
示例#9
0
        static PythonEngine()
        {
            Evaluator = delegate(bool dirty, string script, IEnumerable<KeyValuePair<string, dynamic>> bindings)
            {
                if (dirty)
                {
                    Engine.ProcessCode(script);
                    dirty = false;
                }

                return Engine.Evaluate(PythonBindings.Bindings.Concat(bindings));
            };

            Drawing = delegate { };
        }
示例#10
0
        private void RunEvaluationDelegateTest(EvaluationDelegate evaluation)
        {
            var q1  = NewQuery();
            var cq1 = q1;

            q1.Constrain(GetType());
            cq1 = cq1.Descend("child");
            cq1.Constrain(evaluation);
            var os = q1.Execute();

            Assert.AreEqual(1, os.Count);
            var se = (CsEvaluationDelegate)os.Next();

            Assert.AreEqual("two", se.name);
        }
示例#11
0
        static PythonEngine()
        {
            Evaluator = delegate(bool dirty, string script, IEnumerable <Binding> bindings)
            {
                if (dirty)
                {
                    engine.ProcessCode(script);
                    dirty = false;
                }

                return(engine.Evaluate(PythonBindings.Bindings.Concat(bindings)));
            };

            Drawing = delegate(FScheme.Value val, RenderDescription rd) { };
        }
示例#12
0
        static PythonEngine()
        {
            Evaluator = delegate(bool dirty, string script, IEnumerable <KeyValuePair <string, dynamic> > bindings)
            {
                if (dirty)
                {
                    Engine.ProcessCode(script);
                    dirty = false;
                }

                return(Engine.Evaluate(PythonBindings.Bindings.Concat(bindings)));
            };

            Drawing = delegate { };
        }
    public OptionEvaluator(string optionName, EvaluationDelegate evaluationMethod, ExecutionDelegate executionMethod = null)
    {
        if (string.IsNullOrEmpty(optionName))
        {
            throw new System.ArgumentNullException("'id' can't be null or empty");
        }
        if (evaluationMethod == null)
        {
            throw new System.ArgumentNullException("'evaluationMethod' can't be null");
        }

        Name = optionName;

        Evaluated = false;

        _evaluationMethod = evaluationMethod;
        _executionMethod  = executionMethod;
    }
示例#14
0
        internal static void EvaluationEvaluate(Object a_evaluation, ICandidate a_candidate)
        {
            IEvaluation eval = a_evaluation as IEvaluation;

            if (eval != null)
            {
                eval.Evaluate(a_candidate);
            }
            else
            {
                // use starting _ for PascalCase conversion purposes
                EvaluationDelegate _ed = a_evaluation as EvaluationDelegate;
                if (_ed != null)
                {
                    _ed(a_candidate);
                }
            }
        }
示例#15
0
 public void SetNameDelegate(EvaluationDelegate method)
 {
     _name_delegate = method;
 }
 public EvaluationDelegateWrapper(EvaluationDelegate evaluation) : base(evaluation)
 {
 }
示例#17
0
 public void SetEvaluationCallback(EvaluationDelegate evaluationCallback)
 {
     _evaluate = evaluationCallback;
 }
 public EventCondition(EvaluationDelegate evaluationDelegate, int subjectId)
 {
     this.evaluationDelegate = evaluationDelegate;
     SubjectId = subjectId;
 }
示例#19
0
        static PythonEngine()
        {
            Evaluator = delegate(bool dirty, string script, IEnumerable<Binding> bindings)
            {
                if (dirty)
                {
                    engine.ProcessCode(script);
                    dirty = false;
                }

                return engine.Evaluate(PythonBindings.Bindings.Concat(bindings));
            };
        }
示例#20
0
 public void SetAutoCompleteDelegate(EvaluationDelegate method)
 {
     _auto_complete_delegate = method;
 }
 public EvaluationDelegateWrapper(EvaluationDelegate evaluation) : base(evaluation)
 {	
 }
    public void AddEvaluator(string optionName, EvaluationDelegate evaluationMethod, ExecutionDelegate executionMethod = null)
    {
        OptionEvaluator evaluator = new OptionEvaluator(optionName, evaluationMethod, executionMethod);

        OptionEvaluators.Add(evaluator);
    }
示例#23
0
 public void SetDescriptionDelegate(EvaluationDelegate method)
 {
     _description_deletage = method;
 }