Class SimpleGeneticOptimizationSolver


  • public class SimpleGeneticOptimizationSolver
    extends Solver
    This class implements a simple genetic optimization algorithm for solving optimization problems with box or equality constraints on float variables. Note that equality constraints are encoded in the target function!
    Author:
    Matthias Thimm
    • Constructor Detail

      • SimpleGeneticOptimizationSolver

        public SimpleGeneticOptimizationSolver​(int populationSize,
                                               int populationIncreaseMutation,
                                               int populationIncreaseCrossOver,
                                               int minIterations,
                                               double precision)
        Creates a new simple genetic optimization solver.
        Parameters:
        populationSize - The size of the population
        populationIncreaseMutation - How many new individuals are created by mutation (per individual)
        populationIncreaseCrossOver - How many new individuals are created by cross-over (per pair of individuals)
        minIterations - The minimal number of iterations
        precision - If an iteration improves less than this value the algorithm ends
    • Method Detail

      • solve

        public java.util.Map<Variable,​Term> solve​(ConstraintSatisfactionProblem problem)
                                                 throws GeneralMathException
        Description copied from class: Solver
        Computes a solution to the given constraint satisfaction or optimization problem, i.e. a mapping from variables of the problem to terms.
        Specified by:
        solve in class Solver
        Parameters:
        problem - the actual problem
        Returns:
        a mapping from variables of the problem to terms.
        Throws:
        GeneralMathException - if something went wrong.
      • solve

        public java.util.Map<Variable,​Term> solve​(Term t,
                                                        int optimization_objective)
                                                 throws GeneralMathException
        Returns the variable assignment that maximizes/minimizes the given term (which only contains variables with defined upper and lower bounds).
        Parameters:
        t - the term to be evaluated
        optimization_objective - one of OptimizationProblem.MAXIMIZE, OptimizationProblem.MINIMIZE
        Returns:
        the optimal variable assignment
        Throws:
        GeneralMathException - if some issue occured during computation.
      • isInstalled

        public static boolean isInstalled()
                                   throws java.lang.UnsupportedOperationException
        Throws:
        java.lang.UnsupportedOperationException