public interface ConstructiveProblemForm
Problem
that just provides a fitness function for
whole solutions, we need more than just a fitness function in order to apply ECJ's CO
algorithms.
getAllComponents()
, defining the pool of components that can be used to
construct solutions in your problem domain,getAllowedComponents()
, which defines the subset of components that
can be added to a given partial solution without breaking it.Component
objects returned by these methods come with their heuristic values pre-assigned.
A ConstructiveProblemForm
thus also implicitly implements the heuristic evaluation function, which is
essential to many combinatorial optimization algorithms.ec.app.tsp
,
ec.app.knapsack
Modifier and Type | Method and Description |
---|---|
List<Component> |
getAllComponents() |
List<Component> |
getAllowedComponents(ConstructiveIndividual partialSolution)
Return the allowable "neighborhood" of components that
|
Component |
getArbitraryComponent(EvolutionState state,
int thread)
Chooses an arbitrary component from the problem domain.
|
Component |
getComponentFromString(String s)
Decode a String representation of a solution component.
|
boolean |
isCompleteSolution(ConstructiveIndividual solution)
Determine whether a given specifies a complete solution to this problem.
|
boolean |
isViolated(ConstructiveIndividual partialSolution,
Component component) |
int |
numComponents() |
int numComponents()
boolean isCompleteSolution(ConstructiveIndividual solution)
solution
- A partial or complete solution to this ConstructiveProblemForm.boolean isViolated(ConstructiveIndividual partialSolution, Component component)
partialSolution
- A partial solution to this ConstructiveProblemForm.component
- A component that we may wish to add to the partial solution.List<Component> getAllowedComponents(ConstructiveIndividual partialSolution)
partialSolution
- A collection of components that represent a
partial solution that we wish to add a component to.List<Component> getAllComponents()
Component getComponentFromString(String s)
s
- A String representing a component.Component getArbitraryComponent(EvolutionState state, int thread)
state
- The state (used, for example, to access the simulation's PRNGs)thread
- The thread the caller is operating on. If the caller is single-threaded, just set this to zero.Copyright © 2019. All rights reserved.