public class GradientDescentWeightRouting extends FiniteGradientDescent
FiniteGradientDescent
in order to implements the function
double, umontreal.iro.lecuyer.ccoptim.util.FiniteGradientDescent.Results)
.
The manual relocation method is used when the incumbent solution converges
and the gradient method becomes stuck.
The manual relocation method tries to relocate randomly each variable to
their opposite value.FiniteGradientDescent.Results
Modifier and Type | Field and Description |
---|---|
protected double |
maxRelocationValue |
int |
maxWeightsIndex |
protected double |
minRelocationValue |
protected int |
numRandomTest |
protected RandomStream |
randStream |
bestResults, FINITE_GRADIENT_CENTRAL, FINITE_GRADIENT_FORWARD, func, gradientMethod, lastRunTimeSec, maxBounds, maxDistance, maxIterations, maxItNoImprCorrect, maxItNoImprTol, maxNumRestart, minBounds, minDistance, OPTIM_METHOD_QUASINEWTON, OPTIM_METHOD_SP, OPTIM_METHOD_STANDARD, optimMethod, optTimeLimitSec, relTol, SIMUL_PERTURBATIONS, startDistMult, useManualRelocation
Constructor and Description |
---|
GradientDescentWeightRouting(MultiDimNumFunction f,
double startDistMult,
int maxIt,
double relTol) |
GradientDescentWeightRouting(MultiDimNumFunction f,
double startDistMult,
int maxIt,
double relTol,
RandomStream rand) |
Modifier and Type | Method and Description |
---|---|
double |
getMaxRelocationValue()
Get the maximum weight relocation value that can be generated during
the manual relocation.
|
double |
getMinRelocationValue()
Get the minimum weight relocation value that can be generated during
the manual relocation.
|
protected FiniteGradientDescent.Results |
manualRelocation(double[] currSolution,
double currScore,
FiniteGradientDescent.Results currBestSol)
This method allows the user to manually relocate the incumbent solution if
the gradient search method converged to a solution.
|
void |
setMaxRelocationValue(double max)
Sets the maximum weight that can be generated randomly during the manual relocation.
|
void |
setMaxWeightsIndex(int m)
Sets the maximum (exclusive) index that can be manually relocated.
|
void |
setMinRelocationValue(double min)
Set the minimum weight that can be generated randomly during the manual relocation.
|
adjustSearchDirLength, adjustSolutionBounds, checkInBounds, computeFiniteGradient, computeFiniteGradient2, computeGradientSP, computeMaxAbsDiff, getBestResults, getGradientMethod, getLastRunTimeSec, getMaxBounds, getMaxDistance, getMaxItNoImprCorrect, getMaxItNoImprTol, getMaxNumRestart, getMinBounds, getMinDistance, getOptimizationMethod, getTimeLimitSec, getUseManualRelocation, init, optimize, optimizeQN, optimizeSP, optimizeStd, setBounds, setDistances, setGradientMethod, setMaxDistance, setMaxItNoImprCorrect, setMaxItNoImprTol, setMaxNumRestart, setMinDistance, setOptimizationMethod, setTimeLimitSec, setUseManualRelocation, updateBestResults
protected RandomStream randStream
protected int numRandomTest
public int maxWeightsIndex
protected double maxRelocationValue
protected double minRelocationValue
public GradientDescentWeightRouting(MultiDimNumFunction f, double startDistMult, int maxIt, double relTol)
public GradientDescentWeightRouting(MultiDimNumFunction f, double startDistMult, int maxIt, double relTol, RandomStream rand)
public void setMaxWeightsIndex(int m)
m
- public void setMaxRelocationValue(double max)
max
- the maximum weight that can be generated, must be non-negative.public double getMaxRelocationValue()
public void setMinRelocationValue(double min)
min
- the minimum weight that can be generated, must be non-negative.public double getMinRelocationValue()
protected FiniteGradientDescent.Results manualRelocation(double[] currSolution, double currScore, FiniteGradientDescent.Results currBestSol)
FiniteGradientDescent
The gradient search method will continue if the returned value is not null. Otherwise, the gradient search algorithm will stop. Note that the converged solution is not necessarily the current best solution. It just means that the search algorithm is stuck since it cannot move anymore.
If this method improves over the current best solution, then it must update the
best results variable with the function double)
.
If the relocated solution does not improve the best solution, then the gradient
search algorithm is subject to the no improvement conditions.
Note : This method is not implemented by default and will return null. The user must extend this class to implement his relocation method.
manualRelocation
in class FiniteGradientDescent
currSolution
- the current incumbent solution that converged.currScore
- the score of the current solution.currBestSol
- the current best solution found.FiniteGradientDescent.Results
object or
null to stop the algorithm. The results (if not null) must
contain both the solution vector and the associated score to avoid re-evaluating
this solution.