QLNet.Problem.costFunction C# (CSharp) Method

costFunction() public method

public costFunction ( ) : QLNet.CostFunction
return QLNet.CostFunction
        public CostFunction costFunction()
        {
            return costFunction_;
        }

Usage Example

Ejemplo n.º 1
0
        protected void fillInitialPopulation(List <Candidate> population, Problem p)
        {
            // use initial values provided by the user
            population.First().values = p.currentValue().Clone();
            population.First().cost   = p.costFunction().value(population.First().values);

            if (Double.IsNaN(population.First().cost))
            {
                population.First().cost = Double.MaxValue;
            }

            // rest of the initial population is random
            for (int j = 1; j < population.Count; ++j)
            {
                for (int i = 0; i < p.currentValue().size(); ++i)
                {
                    double l = lowerBound_[i], u = upperBound_[i];
                    population[j].values[i] = l + (u - l) * rng_.nextReal();
                }

                population[j].cost = p.costFunction().value(population[j].values);

                if (Double.IsNaN(population[j].cost))
                {
                    population[j].cost = Double.MaxValue;
                }
            }
        }
All Usage Examples Of QLNet.Problem::costFunction