|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
plugins.big.bigsnakeutils.icy.snake2D.Snake2DOptimizer
public abstract class Snake2DOptimizer
This class encapsulates the optimization aspects of snakes. It handles
objects that implement the Snake2D
interface.
Field Summary | |
---|---|
boolean |
isCurrentBest
The state of the snake being optimized. |
Constructor Summary | |
---|---|
Snake2DOptimizer()
|
Method Summary | |
---|---|
abstract void |
optimize(Snake2D snake,
Snake2DNode[] configuration)
This method should perform the optimization of the Snake2DNode[] object configuration which drives
the Snake2D object snake . |
abstract java.lang.Double |
reportSnakeBestObservedEnergy()
After the optimization completes, this method will be called by the keeper to debrief the optimizer. |
abstract boolean |
reportSnakeDeath()
After the optimization completes, this method will be called by the keeper to debrief the optimizer. |
abstract boolean |
reportSnakeOptimality()
After the optimization completes, this method will be called by the keeper to debrief the optimizer. |
abstract void |
stopOptimizing()
A call to this method should result in the optimization being currently performed by this object to be interrupted. |
void |
wasSuccessfulProbing(Snake2D snake)
Notifies the keeper that the optimizer was successful in its previous attempt to improve the configuration of the snake snake . |
void |
willProbe(Snake2D snake)
Notifies the keeper that the optimizer is about to measure either the energy of the snake snake or its gradient. |
Methods inherited from class java.util.Observable |
---|
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public boolean isCurrentBest
false
before
issuing the statement notifyObservers(snake);
that should
precede a measurement of the energy of the snake. Set to
true
before issuing the statement
notifyObservers(snake);
to notify the
Snake2D.Snake2DKeeper
keeper object that the snake did
indeed improve.
Constructor Detail |
---|
public Snake2DOptimizer()
Method Detail |
---|
public abstract void optimize(Snake2D snake, Snake2DNode[] configuration)
Snake2DNode[]
object configuration
which drives
the Snake2D
object snake
. The initial
configuration should be retrieved from configuration
. When
the optimization is iterative, the iteration loop should contain the
following elements:
snake.setNodes(configuration);
this.isCurrentBest = false;
setChanged();
notifyObservers(snake);
snake.isAlive()
snake.energy();
this.isCurrentBest = true;
setChanged();
notifyObservers(snake);
configuration
energy()
or getEnergyGradient()
methods of the
snake, a call to its isAlive()
method ought to be made to
ensure that it is admissible to carry on with the optimization. In case
the snake died, the optimization should be made to terminate immediately.
public abstract java.lang.Double reportSnakeBestObservedEnergy()
null
if the energy could not be computed even
once. Else, return the best energy that could be observed during
optimization.public abstract boolean reportSnakeDeath()
false
if the snake was still alive when the
optimizer did terminate, or possibly if an eventual death of the
snake was unrelated to the termination decision. Return
true
if the optimizer did indeed terminate because
the snake died.public abstract boolean reportSnakeOptimality()
false
if the optimizer abandoned its task
before the optimization was complete, whatever the reason may
have been. Return true
if the optimizer could bring
its task to completion and found a snake that was deemed to be
optimal.public abstract void stopOptimizing()
optimize
should then be made to return as early as possible.
It is not necessary to restore the optimized snake in any particular
configuration, because the best configuration will have been recorded by
the keeper for each call to the method
notifyObservers(snake)
.
public void wasSuccessfulProbing(Snake2D snake)
snake
. It
is assumed that snake.getNodes();
is going to return
unchanged configuration values.
public void willProbe(Snake2D snake)
snake
or its gradient.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |