public class MGAWeightRoutingIdleness extends MGAWeightRouting
Since there are both the agent idle time and number of idle agents, we let the user choose whether to include the idle time weights in the formula. If the user chooses to not take into account the idle time weights then the coefficients for the agent idle times will be set to 0.
The initial standard deviation for the coefficients of the number of idle agents is set with the same value as for the constant parameters. This is because these coefficients do not multiply by the time, so there are closer to the constant parameters. Also, the number of idle agents should be low.
Summary of the algorithm:
To reduce the simulation time, the solutions are not simulated with less than the normal number of replications. Then only the good solution candidates are re-simulated with the normal number of replications.
AbstractMGAWeightRouting.Results
Modifier and Type | Field and Description |
---|---|
protected boolean |
optimIdleTime |
protected WeightRoutingIdleness.WeightRouterIdleness |
router |
initCoefStd, initConstStd, positiveConstantWeights, positiveTimeCoeffs
bestResults, bestSolPopRatio, canServe, cc, initUserParams, initUserParamsStdRatio, lastRunTimeSec, maxIt, maxNoImprIt, mgaSmoothing, mgaSmoothingRatio, normalDistMinStd, numDimensions, numGroups, numNormalRatio, numTypes, objFunc, popKeep, popSize, rs, sim, simRepRatio, skillList, timeLimitSec, tol, totalNumSkills
Constructor and Description |
---|
MGAWeightRoutingIdleness(CallCenterSim sim,
RoutingObjectiveFunc objFunc) |
Modifier and Type | Method and Description |
---|---|
protected int |
computeNumDimensions()
Internal method to return the number of dimensions of the problem
(or the number of variables to optimize).
|
double |
eval(double[] x)
Evaluate the solution and return the cost from the objective function.
|
void |
exportSolution(String outputFn)
Exports the best weight routing solution found to a new
call center XML parameter file.
|
protected double[] |
generateSolution(double[] mean,
double[] std)
Generate a solution from a normal distribution with the given mean and
standard deviation.
|
double[][] |
getBestNumIdleCoeffs()
Get the numIdleCoeffsGT matrix of the best solution found.
|
double[][] |
getGroupCoeffs(double[] x)
Extracts the agent idle time coefficient matrix from the given solution vector.
|
double |
getInitConstStd()
Get the initial standard deviation of the distributions of the constant weight parameters.
|
double[][] |
getNumIdleCoeffs(double[] x)
Extract the number of idle agent coefficient matrix from the given solution vector.
|
boolean |
getOptimIdleTime()
Returns the choice to optimize the coefficients for the agent idle times.
|
protected double[] |
initializeMean()
Creates a vector that contains the initial mean parameters of the distributions used in the MGA.
|
protected double[] |
initializeStd()
Creates a vector that contains the initial standard deviation parameters of the distributions used in the MGA.
|
protected boolean |
isSolutionValid(double[] x)
Checks if the solution is valid.
|
static void |
main(String[] args) |
void |
optimize(int popSize,
int popKeep,
int maxIt,
int maxNoImprIt,
double tol)
Execute the modified genetic algorithm optimization.
|
protected void |
printExtraInitialParameters()
Method can be overridden to print extra initial parameters.
|
protected void |
printOptimalSolution(double[] x)
Method can be overridden to print the optimal solution.
|
void |
setInitConstStd(double s)
Set the initial standard deviation of the distributions of the
constant parameters of the weight routing policy.
|
void |
setOptimIdleTime(boolean s)
Allows the user to choose to optimize the agent idle time coefficients or not.
|
protected void |
setRouter()
Internal method to set the router.
|
getBestCallCoeffs, getBestConstWeights, getBestGroupCoeffs, getCallCoeffs, getConstWeights, getInitCoefStd, getPositiveConstantWeights, getPositiveTimeCoeffs, restrictToPositiveValues, setInitCoefStd, setPositiveConstantWeights, setPositiveTimeCoeffs
getBestResults, getBestScore, getBestSolPopRatio, getInitUserParams, getInitUserParamsStdRatio, getLastRunTimeSec, getMGASmoothing, getMGASmoothingRatio, getNumNormalRatio, getRandomStream, getSimRepRatio, getSkillList, getTimeLimitSec, getTotalNumSkills, setBestSolPopRatio, setInitUserParams, setInitUserParamsStdRatio, setMGASmoothing, setMGASmoothingRatio, setNumNormalRatio, setRandomStream, setSimRepRatio, setTimeLimitSec, updateBestResults
protected WeightRoutingIdleness.WeightRouterIdleness router
protected boolean optimIdleTime
public MGAWeightRoutingIdleness(CallCenterSim sim, RoutingObjectiveFunc objFunc)
protected void setRouter()
MGAWeightRouting
setRouter
in class MGAWeightRouting
protected int computeNumDimensions()
MGAWeightRouting
computeNumDimensions
in class MGAWeightRouting
public void setInitConstStd(double s)
MGAWeightRouting
setInitConstStd
in class MGAWeightRouting
s
- the initial standard deviation for the constant parameters.public double getInitConstStd()
MGAWeightRouting
getInitConstStd
in class MGAWeightRouting
public void setOptimIdleTime(boolean s)
AbstractMGAWeightRouting.numDimensions
.s
- if true
, then the agent idle time coefficient will be optimizedpublic boolean getOptimIdleTime()
protected void printExtraInitialParameters()
AbstractMGAWeightRouting
int, int, int, double)
will print the initial parameters
of the optimization function and those present in this abstract class.
But the user can print additional informations with this method.
This method is called before executing the optimization, right after
printing the initial parameters of this abstract class.printExtraInitialParameters
in class MGAWeightRouting
protected double[] initializeMean()
MGAWeightRouting
initializeMean
in class MGAWeightRouting
protected double[] initializeStd()
MGAWeightRouting
initializeStd
in class MGAWeightRouting
protected void printOptimalSolution(double[] x)
AbstractMGAWeightRouting
printOptimalSolution
in class MGAWeightRouting
x
- the solution vector to printpublic void optimize(int popSize, int popKeep, int maxIt, int maxNoImprIt, double tol)
AbstractMGAWeightRouting
optimize
in class AbstractMGAWeightRouting
popSize
- the population size at each iteration.popKeep
- the number of solutions to keep in each iteration.maxIt
- the maximum number of iterations.maxNoImprIt
- stopping condition: the maximum number of consecutive iterations without improving
the quantile cost (cost of the most expensive elite solution).tol
- the convergence threshold of the standard variation, the
algorithm stops when all the standard variations are below this level.protected double[] generateSolution(double[] mean, double[] std)
AbstractMGAWeightRouting
generateSolution
in class MGAWeightRouting
mean
- the mean of each variable.std
- the standard deviation of each variable.protected boolean isSolutionValid(double[] x)
MGAWeightRouting
The user can override this method for a more sophisticated procedure.
isSolutionValid
in class MGAWeightRouting
x
- the solution verify its validity.public double[][] getNumIdleCoeffs(double[] x)
x
- the solution vector.public double[][] getGroupCoeffs(double[] x)
MGAWeightRouting
getGroupCoeffs
in class MGAWeightRouting
x
- the solution vector.public double eval(double[] x)
AbstractMGAWeightRouting
eval
in class MGAWeightRouting
x
- the solutionpublic double[][] getBestNumIdleCoeffs()
public void exportSolution(String outputFn)
MGAWeightRouting
exportSolution
in class MGAWeightRouting
outputFn
- filename of the XML file to create.