|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectifs.model.Model
public class Model
Generic model (definition of a problem).
It consists of variables and constraints. It has also capability of memorizing the current
and the best ever found assignment.
Example usage:
MyModel model = new MyModel();
Variable a = new MyVariable("A");
model.addVariable(a);
Variable b = new MyVariable("B");
model.addVariable(b);
Variable c = new MyVariable("C");
model.addVariable(c);
Constraint constr = MyConstraint("all-different");
model.addConstraint(constr);
constr.addVariable(a);
constr.addVariable(b);
constr.addVariable(c);
solver.setInitialSolution(model);
Variable,
Constraint,
Solution,
Solver| Constructor Summary | |
|---|---|
Model()
Constructor |
|
| Method Summary | |
|---|---|
void |
addConstraint(Constraint constraint)
Adds a constraint to the model |
void |
addModelListener(ModelListener listener)
Adds a model listener |
void |
addVariable(Variable variable)
Adds a variable to the model |
void |
afterAssigned(long iteration,
Value value)
Called after a value is assigned to its variable |
void |
afterUnassigned(long iteration,
Value value)
Called after a value is unassigned from its variable |
Vector |
assignedVariables()
The list of assigned variables in the model |
void |
beforeAssigned(long iteration,
Value value)
Called before a value is assigned to its variable |
void |
beforeUnassigned(long iteration,
Value value)
Called before a value is unassigned from its variable |
Vector |
bestUnassignedVariables()
The list of unassigned variables in the best ever found solution |
Hashtable |
conflictConstraints(Value value)
The list of constraints which are in a conflict with the given value if it is assigned to its variable. |
Set |
conflictValues(Value value)
Returns the set of confliction variables with this value, if it is assigned to its variable |
Vector |
constraints()
The list of constraints in the model |
int |
countConstraints()
The number of constraints in the model |
int |
countVariables()
The number of variables in the model |
int |
getBestPerturbations()
Returns the number of perturbation variables in the best ever found solution |
int |
getBestUnassignedVariables()
Returns the number of unassigned variables in the best ever found solution |
Hashtable |
getInfo()
Returns information about the current solution. |
Vector |
getModelListeners()
The list of model listeners |
int |
getTotalValue()
Value of the current solution. |
boolean |
init(Solver solver)
Model initialization |
ModelListener |
modelListenerOfType(Class type)
The list of model listeners that are of the given class |
Vector |
perturbVariables()
The list of perturbation variables in the model, i.e., the variables which has an initial value but which are not assigned with this value. |
void |
removeConstraint(Constraint constraint)
Removes a constraint from the model |
void |
removeModelListener(ModelListener listener)
Removes a model listener |
void |
removeVariable(Variable variable)
Removes a variable from the model |
void |
restoreBest()
Restore the best ever found assignment into the current assignment |
void |
saveBest()
Save the current assignment as the best ever found assignment |
String |
toString()
|
Vector |
unassignedHardConstraints()
The list of hard constraints which contain at least one variable that is not assigned. |
Vector |
unassignedVariables()
The list of unassigned variables in the model |
Vector |
variables()
The list of variables in the model |
Vector |
variablesWithoutInitialValue()
The list of variales without initial value |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Model()
| Method Detail |
|---|
public Vector variables()
public int countVariables()
public void addVariable(Variable variable)
public void removeVariable(Variable variable)
public Vector constraints()
public int countConstraints()
public void addConstraint(Constraint constraint)
public void removeConstraint(Constraint constraint)
public Vector unassignedVariables()
public Vector assignedVariables()
public Vector perturbVariables()
public Set conflictValues(Value value)
public Vector variablesWithoutInitialValue()
public void beforeAssigned(long iteration,
Value value)
public void beforeUnassigned(long iteration,
Value value)
public void afterAssigned(long iteration,
Value value)
public void afterUnassigned(long iteration,
Value value)
public String toString()
toString in class Objectpublic Hashtable getInfo()
public int getBestUnassignedVariables()
public int getBestPerturbations()
public void saveBest()
public void restoreBest()
public Vector bestUnassignedVariables()
public int getTotalValue()
Value.toInt().
public void addModelListener(ModelListener listener)
public void removeModelListener(ModelListener listener)
public boolean init(Solver solver)
public Vector getModelListeners()
public ModelListener modelListenerOfType(Class type)
public Hashtable conflictConstraints(Value value)
Constraint.computeConflicts(Value, Set).
public Vector unassignedHardConstraints()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||