I'm tryin to implement a simple "random search algorithm" in Java
here's a piece of the code:
//execute the algorithm
double bestSolution; //INITIAL SOLUTION!
Vector bestVector=null;
for (int iter=0; iter<maxIterations; iter++) {
//generate random vector-solution
Vector v = Vector.generateRandomVector(problemSize, minOfSearchSpace, maxOfSearchSpace);
double currentObjValue = objectiveFunctionValue(v);
// if a better solution is found
if (currentObjValue < bestSolution); {
bestVector = v;
bestSolution = currentObjValue;
}
System.out.println("Iteration: "+(iter+1)+" Best solution: "+bestSolution);
} // end for
System.out.println("\n\nBest solution: "+bestVector.toString()+" Objective Value: "+bestSolution);
my problem is: somehow i have to initialize the initial solution "double bestSolution". what initial value should i give? note that for certain objective function, values such as "0" while make the convergence harder.