Class Problem
java.lang.Object
com.adriangarcia.metaheuristics.tsmbfoa.Problem
- Direct Known Subclasses:
DesignReinforcedConcreteBeam
,G01_CEC2006
,G02_CEC2006
,G03_CEC2006
,G04_CEC2006
,G05_CEC2006
,G06_CEC2006
,G07_CEC2006
,G08_CEC2006
,G09_CEC2006
,G10_CEC2006
,G11_CEC2006
,G12_CEC2006
,G13_CEC2006
,G15_CEC2006
,G17_CEC2006
,G18_CEC2006
,G21_CEC2006
,G22_CEC2006
,G23_CEC2006
,G24_CEC2006
,PressureVessel
,ProcessSynthesisMINLP
,QuadraticallyConstrainedQuadraticProgram
,TensionCompressionSpring
Problem class where all the characteristics of the input CNOP
problem object are defined.
- Version:
- 1.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addBestResults
(double[] obj) Method that adds the best results found.protected void
addStatistic
(double obj) Method of adding statistics.void
detectConstraints
(String constraints) Method that receives the restrictions of the CNOP, these can be of two types, equality or inequality.int
Method returning TS-MBFOA execution progress.String[]
Method that returns the arguments of the CNOP function.double
Method that returns the best known value for CNOP.double[][]
Method that returns the best results found.String[][]
Method that returns equality constraints.String[][]
Method that returns inequality constraints.double[][]
get Convergence Best Valuedouble[][]
Method that returns data to plot the best results of the mean number of runs.double[][]
Method that returns data to plot the best results.int
Method that returns the number of independent executions of the algorithm.Method that returns the objective function of the problem.Method returning the problem name.int
Method returning the assigned variable number.int
Method to return the number of CNOP variables.getObj()
Method that returns the optimization goal:
Can be:
Problem.MINIMIZATION
Problem.MAXIMIZATIONString[]
Method that returns the order of the CNOP design variables.double[][]
Method that returns the range of CNOP design variables.Method returning the recommended parameter settings.double[]
Method that returns a vector of real numbers representing the statistics.String[]
Method that returns the names of the statistics applied.long
Method that returns the time in seconds in which the configured execution finished.protected void
Start Convergence Best Value AUXprotected void
Method that starts the convergence graph garbage cans.protected void
Starts a new list for conversions.protected void
Start a new list for results.protected void
Start a new list for statistics.protected void
setAdvance
(int advance) Method sets the TS-MBFOA execution progress.void
setBestKnownValue
(double bestKnownValue) Method that sets the best known value for the CNOP.protected void
setConstraintsValuate
(String constraintsValuate) ---protected void
Sets Convergence Best Valueprotected void
setConvergenceBestValueAUX
(int number, double best) Sets Convergence Best Value AUXprotected void
setConvergenceMedia
(int number, double best) Method that sets data to plot the best results of the average of runs.void
setExecutions
(int executions) Method that sets the number of independent executions of the TS-MBFOA.void
setFunction
(String function) Method that establishes the objective function of the problem.
These may be of different types such as:
29.4*x1 + 18*x2
5 * sum{x,1,4,xi}
sum{x,1,4,xi^2} - sum{x,5,13,xi}
sum{x,1,4,xi^2} - prod{x,5,13,xi}
x1
-(100 - (x1 - 5)^2 - (x2 - 5)^2 - (x3 - 5)^2)/100
and more...
the purpose is that mXparse is in charge of evaluating and substituting directly the values for each variable.void
setNameProblem
(String nameProblem) Method that establishes the problem name.protected void
setNumberAssignedVariable
(int numberAssignedVariable) Method setting the assigned variable number.void
Method that sets the optimization objective:void
setOrderVariables
(String varOrder) Method that assigns the order of the CNOP design variables.
e.g: x1,x2,x3,x4,x5,x6,x7
also, the following abbreviation can be used:
if the variables input is:
p1; p2; iter{x,1,3}; iter{y,1,4}; p1; p2
conversion will return
[p1, p2, x1, x2, x3, y1, y2, y3, y4, p1, p2]
all elements inside the iteration are separated by commas (,) and outside the iteration are separated by semicolons (;).void
setRankVariable
(String rankVariable) Method that establishes the range of CNOP design variables.
e.g: (0,1.4),(0,1.2),(3.25,4),(0.5,2)
also, the following abbreviation can be used:
(0,1.2);(0,1.8);ran{3:7,0:1.2};ran{8:10,0.25:2}
conversion will return
(0,1.2),(0,1.8),(0,1.2),(0,1.2),(0,1.2),(0,1.2),(0,1.2),(0.25,2),(0.25,2),(0.25,2)
all elements within the iteration are separated by commas (,) and ranges by colons (:) and outside the iteration are separated by semicolons (;).protected void
setTimeSeconds
(long timeSeconds) Method that sets the time in seconds in which the configured execution is finished.
-
Field Details
-
MINIMIZATION
- See Also:
-
MAXIMIZATION
- See Also:
-
INEQUALITY
- See Also:
-
EQUALITY
- See Also:
-
configurator
-
-
Constructor Details
-
Problem
public Problem()Empty constructor method for object instance.
-
-
Method Details
-
newResults
protected void newResults()Start a new list for results. -
newStatistic
protected void newStatistic()Start a new list for statistics. -
newConverter
protected void newConverter()Starts a new list for conversions. -
addStatistic
protected void addStatistic(double obj) Method of adding statistics.- Parameters:
obj
- statistics
-
getStatistic
public double[] getStatistic()Method that returns a vector of real numbers representing the statistics.- Returns:
- statistics
-
addBestResults
protected void addBestResults(double[] obj) Method that adds the best results found.- Parameters:
obj
- best value
-
getBestResults
public double[][] getBestResults()Method that returns the best results found.- Returns:
- best value
-
getNameProblem
Method returning the problem name.- Returns:
- the nameProblem
-
setNameProblem
Method that establishes the problem name.- Parameters:
nameProblem
- the nameProblem to set
-
getFunction
Method that returns the objective function of the problem.- Returns:
- the function
-
setFunction
Method that establishes the objective function of the problem.
These may be of different types such as:
29.4*x1 + 18*x2
5 * sum{x,1,4,xi}
sum{x,1,4,xi^2} - sum{x,5,13,xi}
sum{x,1,4,xi^2} - prod{x,5,13,xi}
x1
-(100 - (x1 - 5)^2 - (x2 - 5)^2 - (x3 - 5)^2)/100
and more...
the purpose is that mXparse is in charge of evaluating and substituting directly the values for each variable.
Syntax allowed for summations and products is:
summation: sum{var, from, to, f(x1,x2,...,xn)}
Product: prod{var, from, to, f(x1,x2,...,xn)}- Parameters:
function
- the function to set
-
getNumberAssignedVariable
public int getNumberAssignedVariable()Method returning the assigned variable number.- Returns:
- the numberAssignedVariable
-
setNumberAssignedVariable
protected void setNumberAssignedVariable(int numberAssignedVariable) Method setting the assigned variable number.- Parameters:
numberAssignedVariable
- the numberAssignedVariable to set
-
getRankVariable
public double[][] getRankVariable()Method that returns the range of CNOP design variables.- Returns:
- the rankVariable
-
setRankVariable
Method that establishes the range of CNOP design variables.
e.g: (0,1.4),(0,1.2),(3.25,4),(0.5,2)
also, the following abbreviation can be used:
(0,1.2);(0,1.8);ran{3:7,0:1.2};ran{8:10,0.25:2}
conversion will return
(0,1.2),(0,1.8),(0,1.2),(0,1.2),(0,1.2),(0,1.2),(0,1.2),(0.25,2),(0.25,2),(0.25,2)
all elements within the iteration are separated by commas (,) and ranges by colons (:) and outside the iteration are separated by semicolons (;).- Parameters:
rankVariable
- the rankVariable to set
-
getOrderVariables
Method that returns the order of the CNOP design variables.- Returns:
- the orderVariables
-
setOrderVariables
Method that assigns the order of the CNOP design variables.
e.g: x1,x2,x3,x4,x5,x6,x7
also, the following abbreviation can be used:
if the variables input is:
p1; p2; iter{x,1,3}; iter{y,1,4}; p1; p2
conversion will return
[p1, p2, x1, x2, x3, y1, y2, y3, y4, p1, p2]
all elements inside the iteration are separated by commas (,) and outside the iteration are separated by semicolons (;).- Parameters:
varOrder
- the orderVariables
-
getConstraintsEquality
Method that returns equality constraints.- Returns:
- the constraintsEquality
-
getConstraintsInequality
Method that returns inequality constraints.- Returns:
- the constraintsInequality
-
detectConstraints
Method that receives the restrictions of the CNOP, these can be of two types, equality or inequality. The correct syntax to include them is the following:
[opening brace][mathematical expression][conditional operator][results][closing brace][semicolon]
e.g:
{-127 + 2 * x1^2 + 3 * x2^4 + x3 + 4 * x4^2 + 5 * x5 <= 0}
if there are more than one restriction they can be separated by semicolons [;]
{y1 + x1 <= 1.2}; {y2 + x2 <= 1.8}; {y2^2 + x2^2 <= 1.64}; ...; [n-constraints]- Parameters:
constraints
- constraints
-
getObj
Method that returns the optimization goal:
Can be:
Problem.MINIMIZATION
Problem.MAXIMIZATION- Returns:
- the obj
-
setObj
Method that sets the optimization objective:- Parameters:
obj
- the obj to set
-
getExecutions
public int getExecutions()Method that returns the number of independent executions of the algorithm.- Returns:
- the executions
-
setExecutions
public void setExecutions(int executions) Method that sets the number of independent executions of the TS-MBFOA. This must be an enter qua number from 1 to 30.- Parameters:
executions
- the executions to set
-
getRecommendedSetting
Method returning the recommended parameter settings.- Returns:
- configurator
-
getBestKnownValue
public double getBestKnownValue()Method that returns the best known value for CNOP.- Returns:
- the bestKnownValue
-
setBestKnownValue
public void setBestKnownValue(double bestKnownValue) Method that sets the best known value for the CNOP.- Parameters:
bestKnownValue
- the bestKnownValue to set
-
getStatisticsName
Method that returns the names of the statistics applied.- Returns:
- the statisticsName
-
getNumberVariableOF
public int getNumberVariableOF()Method to return the number of CNOP variables.- Returns:
- the number Variable OF
-
getTimeSeconds
public long getTimeSeconds()Method that returns the time in seconds in which the configured execution finished.- Returns:
- the time Seconds
-
setTimeSeconds
protected void setTimeSeconds(long timeSeconds) Method that sets the time in seconds in which the configured execution is finished.- Parameters:
timeSeconds
- the timeSeconds to set
-
getArguments
Method that returns the arguments of the CNOP function.- Returns:
- the arguments
-
setConstraintsValuate
---- Parameters:
constraintsValuate
- the arguments to set
-
getAdvance
public int getAdvance()Method returning TS-MBFOA execution progress.- Returns:
- the advance
-
setAdvance
protected void setAdvance(int advance) Method sets the TS-MBFOA execution progress.- Parameters:
advance
- the advance to set
-
getDataGraphicsBestResults
public double[][] getDataGraphicsBestResults()Method that returns data to plot the best results.- Returns:
- Data Graphics Best Results
-
iniConvergenceMedia
protected void iniConvergenceMedia()Method that starts the convergence graph garbage cans. -
setConvergenceMedia
protected void setConvergenceMedia(int number, double best) Method that sets data to plot the best results of the average of runs.- Parameters:
number
- valuesbest
- best values
-
getConvergenceMedia
public double[][] getConvergenceMedia()Method that returns data to plot the best results of the mean number of runs.- Returns:
- Convergence Media
-
iniConvergenceBestValueAUX
protected void iniConvergenceBestValueAUX()Start Convergence Best Value AUX -
setConvergenceBestValueAUX
protected void setConvergenceBestValueAUX(int number, double best) Sets Convergence Best Value AUX- Parameters:
number
- value auxbest
- best value aux
-
setConvergenceBestValue
protected void setConvergenceBestValue()Sets Convergence Best Value -
getConvergenceBestValue
public double[][] getConvergenceBestValue()get Convergence Best Value- Returns:
- Convergence Best Value
-