Class SimpleGeneticOptimizationSolver
java.lang.Object
org.tweetyproject.math.opt.solver.Solver
org.tweetyproject.math.opt.solver.SimpleGeneticOptimizationSolver
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 Summary
ConstructorDescriptionSimpleGeneticOptimizationSolver
(int populationSize, int populationIncreaseMutation, int populationIncreaseCrossOver, int minIterations, double precision) Creates a new simple genetic optimization solver. -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Return if solver is installedComputes a solution to the given constraint satisfaction or optimization problem, i.e.Returns the variable assignment that maximizes/minimizes the given term (which only contains variables with defined upper and lower bounds).Methods inherited from class org.tweetyproject.math.opt.solver.Solver
getDefaultGeneralSolver, getDefaultIntegerLinearSolver, getDefaultLinearSolver, hasDefaultGeneralSolver, hasDefaultIntegerLinearSolver, hasDefaultLinearSolver, setDefaultGeneralSolver, setDefaultIntegerLinearSolver, setDefaultLinearSolver
-
Constructor Details
-
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 populationpopulationIncreaseMutation
- 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 iterationsprecision
- If an iteration improves less than this value the algorithm ends
-
-
Method Details
-
solve
public Map<Variable,Term> solve(GeneralConstraintSatisfactionProblem 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 classSolver
- Parameters:
problem
- the actual problem- Returns:
- a mapping from variables of the problem to terms.
- Throws:
GeneralMathException
- if something went wrong.
-
solve
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 evaluatedoptimization_objective
- one of OptimizationProblem.MAXIMIZE, OptimizationProblem.MINIMIZE- Returns:
- the optimal variable assignment
- Throws:
GeneralMathException
- if some issue occured during computation.
-
isInstalled
Return if solver is installed- Returns:
- if solver is installed
- Throws:
UnsupportedOperationException
- UnsupportedOperationException
-