Class AnnealingAdvancementChooser

    • Field Detail

      • maxTemp

        protected double maxTemp
      • jumped

        protected boolean jumped
      • preJumpRunResult

        protected double preJumpRunResult
    • Constructor Detail

      • AnnealingAdvancementChooser

        public AnnealingAdvancementChooser()
      • AnnealingAdvancementChooser

        public AnnealingAdvancementChooser​(CoolingSchedule schedule,
                                           double initialTemp)
    • Method Detail

      • chooseAdvancement

        public AdvanceType chooseAdvancement​(ParameterSetter init,
                                             AdvanceType lastType,
                                             double runResult)
        Description copied from class: HillClimber
        This performs the hill climbing algorithm. In the best case it will traverse the space by (assuming we've just chosen a new parameter):
        • Explore the local space to find which direction to follow. It first will explore to the right (FORWARD) of the current position, then to the left (BACKWARD).
        • Next it will move whichever direction is best of left, right, and the neither (if we're at a peak). If we're on a peak it will return AdvanceType.SWITCH.

        Because of the implementation, this may result in a single spot being executed multiple times in order. Also, this handles the border cases where it cannot move forwards or backwards (but wishes to) by switching.

        Specified by:
        chooseAdvancement in interface AdvancementChooser
        Overrides:
        chooseAdvancement in class HillClimber
        Parameters:
        init - the current setter
        lastType - the last executed parameter command
        runResult - the last run's value
        Returns:
        the action to perform
      • shouldRevert

        public boolean shouldRevert​(double runResult)
        Description copied from class: HillClimber
        Returns true when the previous run's value was greater than runResult or when we're exploring the local space to figure out which direction to go.
        Specified by:
        shouldRevert in interface AdvancementChooser
        Overrides:
        shouldRevert in class HillClimber
        Parameters:
        runResult - the result of the previous run
        Returns:
        if we should revert to the previous space
      • chooseRandom

        protected boolean chooseRandom()
      • getRandom

        protected double getRandom()