Пример #1
0
        /// <summary>
        /// Initializes the bit string.
        /// </summary>
        /// <param name="discreteSpaceDescriptor">The discrete space descriptor.</param>
        /// <returns>BitByteHexLimits[].</returns>
        internal static BitByteHexLimits[] InitializeBitString(DesignSpaceDescription discreteSpaceDescriptor)
        {
            var result       = new BitByteHexLimits[discreteSpaceDescriptor.n];
            var currentIndex = 0;

            for (var i = 0; i < discreteSpaceDescriptor.n; i++)
            {
                if (discreteSpaceDescriptor[i].Discrete)
                {
                    var maxValue   = discreteSpaceDescriptor.MaxVariableSizes[i];
                    var numberBits = (int)(Math.Log(maxValue, 2)) + 1;
                    var endIndex   = currentIndex + numberBits;
                    result[i] = new BitByteHexLimits
                    {
                        StartIndex = currentIndex,
                        EndIndex   = endIndex,
                        MaxValue   = maxValue
                    };
                    currentIndex = endIndex;
                }
                else
                {
                    result[i] = new BitByteHexLimits();
                }
            }
            return(result);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="BitStringNeighborGenerator"/> class.
 /// </summary>
 /// <param name="discreteSpaceDescriptor">The discrete space descriptor.</param>
 public BitStringNeighborGenerator(DesignSpaceDescription discreteSpaceDescriptor)
     : base(discreteSpaceDescriptor)
 {
     limits          = BitByteHexFunctions.InitializeBitString(discreteSpaceDescriptor);
     bitStringLength = limits[n - 1].EndIndex;
     rnd             = new Random();
 }
Пример #3
0
 public GAMutationBitString(DesignSpaceDescription discreteSpaceDescriptor, double mutationRate = 0.1)
     : base(discreteSpaceDescriptor)
 {
     limits          = BitByteHexFunctions.InitializeBitString(discreteSpaceDescriptor);
     bitStringLength = limits[n - 1].EndIndex;
     mRatePerBit     = mutationRate / bitStringLength;
     rnd             = new Random();
 }
Пример #4
0
 public GACrossoverBitString(DesignSpaceDescription discreteSpaceDescriptor, double crossoverRate = 1.7)
     : base(discreteSpaceDescriptor)
 {
     limits          = BitByteHexFunctions.InitializeBitString(discreteSpaceDescriptor);
     bitStringLength = limits[n - 1].EndIndex;
     xRatePerBit     = crossoverRate / bitStringLength;
     rnd             = new Random();
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProblemDefinition" /> class.
 /// </summary>
 public ProblemDefinition()
 {
     ConvergenceMethods = new List <abstractConvergence>();
     SpaceDescriptor    = new DesignSpaceDescription();
     f            = new List <IObjectiveFunction>();
     g            = new List <IInequality>();
     h            = new List <IEquality>();
     FunctionList = new ListforIOptFunctions(f, g, h);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="StochasticNeighborGenerator"/> class.
 /// </summary>
 /// <param name="discreteSpaceDescriptor">The discrete space descriptor.</param>
 /// <param name="direction">The direction.</param>
 /// <param name="maxNumNeighbors">The maximum number neighbors.</param>
 public StochasticNeighborGenerator(DesignSpaceDescription discreteSpaceDescriptor, optimize direction,
                                    int maxNumNeighbors = 250)
     : base(discreteSpaceDescriptor)
 {
     r              = new Random();
     changeVectors  = discreteSpaceDescriptor.CreateNeighborChangeVectors(maxNumNeighbors);
     this.direction = direction;
     ResetStats();
 }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ImplicitEnueration" /> class.
 /// </summary>
 /// <param name="SpaceDescription">The space description.</param>
 /// <param name="direction">The direction.</param>
 public ImplicitEnueration(DesignSpaceDescription SpaceDescription, optimize direction)
 {
     spaceDescription                  = SpaceDescription;
     this.direction                    = direction;
     comparer                          = new optimizeSort(direction);
     RequiresObjectiveFunction         = false;
     ConstraintsSolvedWithPenalties    = false;
     InequalitiesConvertedToEqualities = false;
     RequiresSearchDirectionMethod     = false;
     RequiresLineSearchMethod          = false;
     RequiresAnInitialPoint            = false;
     RequiresConvergenceCriteria       = false;
     RequiresFeasibleStartPoint        = false;
     RequiresDiscreteSpaceDescriptor   = true;
 }
Пример #8
0
 public ExhaustiveSearch(DesignSpaceDescription SpaceDescription, optimize direction)
 {
     spaceDescription = SpaceDescription;
     if (!SpaceDescription.AllDiscrete)
     {
         throw new Exception("Exhaustive Search can only be used when Space is all discrete");
     }
     comparer = new optimizeSort(direction);
     RequiresObjectiveFunction         = false;
     ConstraintsSolvedWithPenalties    = false;
     InequalitiesConvertedToEqualities = false;
     RequiresSearchDirectionMethod     = false;
     RequiresLineSearchMethod          = false;
     RequiresAnInitialPoint            = false;
     RequiresConvergenceCriteria       = false;
     RequiresFeasibleStartPoint        = false;
     RequiresDiscreteSpaceDescriptor   = true;
 }
 public GADifferentialEvolutionCrossover(DesignSpaceDescription discreteSpaceDescriptor)
     : base(discreteSpaceDescriptor)
 {
 }
Пример #10
0
 public RandomSampling(DesignSpaceDescription discreteSpaceDescriptor)
     : base(discreteSpaceDescriptor)
 {
     rnd = new Random();
 }
Пример #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GeneticMutationGenerator" /> class.
 /// </summary>
 /// <param name="discreteSpaceDescriptor">The discrete space descriptor.</param>
 protected GeneticMutationGenerator(DesignSpaceDescription discreteSpaceDescriptor)
     : base(discreteSpaceDescriptor)
 {
 }
Пример #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GeneticCrossoverGenerator" /> class.
 /// </summary>
 /// <param name="discreteSpaceDescriptor">The discrete space descriptor.</param>
 protected GeneticCrossoverGenerator(DesignSpaceDescription discreteSpaceDescriptor)
     : base(discreteSpaceDescriptor)
 {
 }
Пример #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SamplingGenerator" /> class.
 /// </summary>
 /// <param name="discreteSpaceDescriptor">The discrete space descriptor.</param>
 protected SamplingGenerator(DesignSpaceDescription discreteSpaceDescriptor)
     : base(discreteSpaceDescriptor)
 {
 }
Пример #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LatinHyperCube"/> class.
 /// </summary>
 /// <param name="discreteSpaceDescriptor">The discrete space descriptor.</param>
 /// <param name="GenerateFor">The generate for.</param>
 public LatinHyperCube(DesignSpaceDescription discreteSpaceDescriptor, VariablesInScope GenerateFor)
     : base(discreteSpaceDescriptor)
 {
     generateFor = GenerateFor;
 }
Пример #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExhaustiveNeighborGenerator"/> class.
 /// </summary>
 /// <param name="discreteSpaceDescriptor">The discrete space descriptor.</param>
 /// <param name="minNumNeighbors">The minimum number neighbors.</param>
 public ExhaustiveNeighborGenerator(DesignSpaceDescription discreteSpaceDescriptor, int minNumNeighbors = 250)
     : base(discreteSpaceDescriptor)
 {
     r             = new Random();
     changeVectors = discreteSpaceDescriptor.CreateNeighborChangeVectors(minNumNeighbors);
 }
Пример #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="abstractGenerator" /> class.
 /// </summary>
 /// <param name="discreteSpaceDescriptor">The discrete space descriptor.</param>
 protected abstractGenerator(DesignSpaceDescription discreteSpaceDescriptor)
 {
     this.discreteSpaceDescriptor = discreteSpaceDescriptor;
 }
Пример #17
0
 public ParticleSwarm(DesignSpaceDescription discreteSpaceDescriptor)
     : base(discreteSpaceDescriptor)
 {
 }