|
||||||||||
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.snake3D.Snake3DOptimizer
public abstract class Snake3DOptimizer
This class encapsulates the optimization aspects of snakes. It handles
objects that implement the Snake3D
interface.
Field Summary | |
---|---|
boolean |
isCurrentBest
The state of the snake being optimized. |
Constructor Summary | |
---|---|
Snake3DOptimizer()
|
Method Summary | |
---|---|
abstract void |
optimize(Snake3D snake,
Snake3DNode[] configuration)
This method should perform the optimization of the Snake3DNode[] object configuration which drives
the Snake3D 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(Snake3D snake)
Notifies the keeper that the optimizer was successful in its previous attempt to improve the configuration of the snake snake . |
void |
willProbe(Snake3D 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 Snake3DOptimizer()
Method Detail |
---|
public abstract void optimize(Snake3D snake, Snake3DNode[] configuration)
Snake3DNode[]
object configuration
which drives
the Snake3D
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(Snake3D snake)
snake
. It
is assumed that snake.getNodes();
is going to return
unchanged configuration values.
public void willProbe(Snake3D snake)
snake
or its gradient.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |