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

public class Problem extends Object
Problem class where all the characteristics of the input CNOP problem object are defined.
Version:
1.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Empty constructor method for object instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addBestResults(double[] obj)
    Method that adds the best results found.
    protected void
    addStatistic(double obj)
    Method of adding statistics.
    void
    Method that receives the restrictions of the CNOP, these can be of two types, equality or inequality.
    int
    Method returning TS-MBFOA execution progress.
    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 Value
    double[][]
    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.
    Method that returns the optimization goal:
    Can be:

    Problem.MINIMIZATION
    Problem.MAXIMIZATION
    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.
    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 AUX
    protected 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 Value
    protected void
    setConvergenceBestValueAUX(int number, double best)
    Sets Convergence Best Value AUX
    protected 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
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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

      public String getNameProblem()
      Method returning the problem name.
      Returns:
      the nameProblem
    • setNameProblem

      public void setNameProblem(String nameProblem)
      Method that establishes the problem name.
      Parameters:
      nameProblem - the nameProblem to set
    • getFunction

      public String getFunction()
      Method that returns the objective function of the problem.
      Returns:
      the function
    • setFunction

      public 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.
      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

      public 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 (;).
      Parameters:
      rankVariable - the rankVariable to set
    • getOrderVariables

      public String[] getOrderVariables()
      Method that returns the order of the CNOP design variables.
      Returns:
      the orderVariables
    • setOrderVariables

      public 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 (;).
      Parameters:
      varOrder - the orderVariables
    • getConstraintsEquality

      public String[][] getConstraintsEquality()
      Method that returns equality constraints.
      Returns:
      the constraintsEquality
    • getConstraintsInequality

      public String[][] getConstraintsInequality()
      Method that returns inequality constraints.
      Returns:
      the constraintsInequality
    • detectConstraints

      public void detectConstraints(String constraints)
      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

      public String getObj()
      Method that returns the optimization goal:
      Can be:

      Problem.MINIMIZATION
      Problem.MAXIMIZATION
      Returns:
      the obj
    • setObj

      public void setObj(String obj)
      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

      public Configurator 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

      public String[] 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

      public String[] getArguments()
      Method that returns the arguments of the CNOP function.
      Returns:
      the arguments
    • setConstraintsValuate

      protected void setConstraintsValuate(String constraintsValuate)
      ---
      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 - values
      best - 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 aux
      best - best value aux
    • setConvergenceBestValue

      protected void setConvergenceBestValue()
      Sets Convergence Best Value
    • getConvergenceBestValue

      public double[][] getConvergenceBestValue()
      get Convergence Best Value
      Returns:
      Convergence Best Value