|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.coinor.opents.SolutionAdapter
This is the class to extend when creating your own solution definitions.
It is essential that you still implement your own clone()
method and clone whatever custom properties you have in your solution definition.
For an excellent discussion of cloning techniques, see the Java Developer Connection Tech Tip http://developer.java.sun.com/developer/JDCTechTips/2001/tt0306.html.
Here is an example of how to clone your solution.
Notice that it properly calls the super.clone()
method so that the SolutionAdapter
's
clone()
method is also called.
Then an int array is cloned and a HashMap
is cloned.
...
public Object clone()
{
MySolution sol = (MySolution) super.clone();
sol.myIntArray = (int[]) this.myIntArray.clone();
sol.myMap = (HashMap) this.myMap.clone();
} // end clone
...
This code is licensed for public use under the Common Public License version 0.5.
The Common Public License, developed by IBM and modeled after their industry-friendly IBM Public License,
differs from other common open source licenses in several important ways:
Copyright © 2001 Robert Harder
Constructor Summary | |
SolutionAdapter()
|
Method Summary | |
java.lang.Object |
clone()
An essential Java method that returns of copy of the object. |
double[] |
getObjectiveValue()
If the value has been set for this solution, then the value will be returned. |
void |
setObjectiveValue(double[] objValue)
Generally used by the TabuSearch to set the value of the
objective function
and set objectiveValid to true. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SolutionAdapter()
Method Detail |
public final double[] getObjectiveValue()
TabuSearch
has not yet
set the solution's value.
getObjectiveValue
in interface Solution
public final void setObjectiveValue(double[] objValue)
TabuSearch
to set the value of the
objective function
and set objectiveValid to true.
setObjectiveValue
in interface Solution
objValue
- The objective function valuepublic java.lang.Object clone()
clone
in interface Solution
Cloneable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |