|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opt4j.satdecoding.AbstractSATDecoder<G,P>
G - The genotype (use Genotype if you do not override the
decode method)P - The phenotypepublic abstract class AbstractSATDecoder<G extends org.opt4j.core.Genotype,P>
The AbstractSATDecoder can be used for the construction of custom SAT
Decoders.
The Creator part takes the problem dependent Constraints and
creates a SATGenotype according to the variables which is the input
for the specified Optimizer.
The Decoder takes a SATGenotype, converts it to an
Order of the variables, and solves the problem in the Order
using a SAT Solver . The resulting Model, which respects the
Constraints, must then be converted to the problem specific
phenotype.
| Field Summary | |
|---|---|
protected boolean |
isInit
|
protected java.util.Map<java.lang.Object,java.lang.Double> |
lowerBounds
|
protected SATManager |
manager
|
protected java.util.Random |
random
|
protected java.util.Map<java.lang.Object,java.lang.Double> |
upperBounds
|
| Constructor Summary | |
|---|---|
AbstractSATDecoder(SATManager manager,
org.opt4j.core.common.random.Rand random)
Constructs an AbstractSATDecoder with the given
SATManager. |
|
| Method Summary | |
|---|---|
abstract P |
convertModel(Model model)
Converts a Model into a phenotype. |
G |
create()
|
abstract java.util.Set<Constraint> |
createConstraints()
Creates all Constraints. |
protected org.opt4j.core.Genotype |
createSATGenotype()
Returns a random SAT genotype of the constrained problem. |
P |
decode(G genotype)
|
protected Model |
decodeSATGenotype(org.opt4j.core.Genotype genotype)
Decodes the Genotype to a phenotype by using a SAT/PB solver. |
java.util.List<Constraint> |
getConstraints()
Returns the constraints. |
java.util.Map<java.lang.Object,java.lang.Double> |
getLowerBounds(java.util.Set<java.lang.Object> variables)
Returns the lower bounds for the variables. |
java.util.Map<java.lang.Object,java.lang.Double> |
getUpperBounds(java.util.Set<java.lang.Object> variables)
Returns the upper bounds for the variables. |
java.util.List<java.lang.Object> |
getVariables()
Returns the variables. |
java.util.Set<java.lang.Object> |
ignoreVariables(java.util.Set<java.lang.Object> variables)
Set the variables to be ignored (not part of the search process and genotype). |
protected void |
init()
Initializes the Constraints and variables. |
void |
randomize(java.util.Collection<java.lang.Object> variables,
java.util.Map<java.lang.Object,java.lang.Double> lowerBounds,
java.util.Map<java.lang.Object,java.lang.Double> upperBounds,
java.util.Map<java.lang.Object,java.lang.Double> priorities,
java.util.Map<java.lang.Object,java.lang.Boolean> phases)
Creates a random initialization of the priorities and phases for the variables. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Map<java.lang.Object,java.lang.Double> lowerBounds
protected java.util.Map<java.lang.Object,java.lang.Double> upperBounds
protected final java.util.Random random
protected final SATManager manager
protected boolean isInit
| Constructor Detail |
|---|
@Inject
public AbstractSATDecoder(SATManager manager,
org.opt4j.core.common.random.Rand random)
AbstractSATDecoder with the given
SATManager.
manager - the specified sat managerrandom - the random number generator| Method Detail |
|---|
protected void init()
Constraints and variables.
public abstract java.util.Set<Constraint> createConstraints()
Constraints.
Override this method to return the problem specific Constraints
that have to be respected by the resulting Model.
public void randomize(java.util.Collection<java.lang.Object> variables,
java.util.Map<java.lang.Object,java.lang.Double> lowerBounds,
java.util.Map<java.lang.Object,java.lang.Double> upperBounds,
java.util.Map<java.lang.Object,java.lang.Double> priorities,
java.util.Map<java.lang.Object,java.lang.Boolean> phases)
variables - all variableslowerBounds - the lower bounds for the priority for the variablesupperBounds - the upper bounds for the priority for the variablespriorities - the priorities of the variablesphases - the phases of the variablespublic java.util.Set<java.lang.Object> ignoreVariables(java.util.Set<java.lang.Object> variables)
variables - all variables of the problem
public java.util.Map<java.lang.Object,java.lang.Double> getLowerBounds(java.util.Set<java.lang.Object> variables)
variables - all variables of the problem
public java.util.Map<java.lang.Object,java.lang.Double> getUpperBounds(java.util.Set<java.lang.Object> variables)
variables - all variables of the problem
public abstract P convertModel(Model model)
Model into a phenotype. Override this with your custom
method.
model - the found model
public G create()
create in interface org.opt4j.core.problem.Creator<G extends org.opt4j.core.Genotype>protected org.opt4j.core.Genotype createSATGenotype()
public P decode(G genotype)
decode in interface org.opt4j.core.problem.Decoder<G extends org.opt4j.core.Genotype,P>protected Model decodeSATGenotype(org.opt4j.core.Genotype genotype)
Genotype to a phenotype by using a SAT/PB solver.
genotype - the genotype
public java.util.List<Constraint> getConstraints()
public java.util.List<java.lang.Object> getVariables()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||