AnnealingScheme scheme = new AnnealingScheme();
scheme.setFunction(new ObjectiveFunction()
{
public int getNdim()
{
return 1;
}
/*
this function must return a number which is a measure of
* the goodness of the
proposed solution
*/
public double distance(double[] vertex)
{
return Math.pow(vertex[0]-3,
2);
}
});
/* this
is where we search for a solution */
scheme.anneal();
/* print solution
*/
double[] offset;
offset = scheme.getOffset();
System.out.println("Solution:");
for (int i = 0; i < offset.length; i++)
{
System.out.println(offset[i]);
}