<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article  PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd"><article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article"><front><journal-meta><journal-id journal-id-type="publisher-id">OJAppS</journal-id><journal-title-group><journal-title>Open Journal of Applied Sciences</journal-title></journal-title-group><issn pub-type="epub">2165-3917</issn><publisher><publisher-name>Scientific Research Publishing</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.4236/ojapps.2022.126069</article-id><article-id pub-id-type="publisher-id">OJAppS-118127</article-id><article-categories><subj-group subj-group-type="heading"><subject>Articles</subject></subj-group><subj-group subj-group-type="Discipline-v2"><subject>Biomedical&amp;Life Sciences</subject><subject> Chemistry&amp;Materials Science</subject><subject> Computer Science&amp;Communications</subject><subject> Engineering</subject><subject> Physics&amp;Mathematics</subject></subj-group></article-categories><title-group><article-title>
 
 
  Generic Simulated Annealing
 
</article-title></title-group><contrib-group><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Chadi</surname><given-names>Kallab</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Samir</surname><given-names>Haddad</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref><xref ref-type="corresp" rid="cor1"><sup>*</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Jinane</surname><given-names>Sayah</given-names></name><xref ref-type="aff" rid="aff2"><sup>2</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Mohamad</surname><given-names>Chakroun</given-names></name><xref ref-type="aff" rid="aff3"><sup>3</sup></xref></contrib></contrib-group><aff id="aff3"><addr-line>Faculty of Computer Science and Electrical Engineering, Universit&amp;amp;auml;t Rostock, Rostock, Germany</addr-line></aff><aff id="aff2"><addr-line>Department of Telecom and Networks, Issam Fares Faculty of Technology, University of Balamand, Koura, Lebanon</addr-line></aff><aff id="aff1"><addr-line>Department of Computer Science and Mathematics, Faculty of Arts and Sciences, University of Balamand, Koura, Lebanon</addr-line></aff><pub-date pub-type="epub"><day>06</day><month>06</month><year>2022</year></pub-date><volume>12</volume><issue>06</issue><fpage>1011</fpage><lpage>1025</lpage><history><date date-type="received"><day>28,</day>	<month>May</month>	<year>2022</year></date><date date-type="rev-recd"><day>26,</day>	<month>June</month>	<year>2022</year>	</date><date date-type="accepted"><day>29,</day>	<month>June</month>	<year>2022</year></date></history><permissions><copyright-statement>&#169; Copyright  2014 by authors and Scientific Research Publishing Inc. </copyright-statement><copyright-year>2014</copyright-year><license><license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p></license></permissions><abstract><p>
 
 
  One of the many problems that are considered to be NP-Hard is the Multiple Sequence Alignment one that initially requires, as for any other of its siblings, a specific encoding schema and design of the main functionalities of the heuristics algorithm being implemented and executed. This paper intends to discuss our proposed generic implementation of the Simulated Annealing, inspired for the procedure of cooling and shaping methods of metals. In our algorithm, we attempted to add some executions tracing functionalities in order to help later analysis for initial parameters tuning. On another hand, we also tried to get closer in our attempt to mimic the cooling of metals, but giving it an option to run under different cooling schedules. We proposed a few schedules that seemed to be studied and/or used in many algorithm implementations.
 
</p></abstract><kwd-group><kwd>Generic</kwd><kwd> Heuristics</kwd><kwd> Phylogenies</kwd><kwd> Bio-Informatics</kwd><kwd> NP-Hard</kwd><kwd> Simulated Annealing</kwd></kwd-group></article-meta></front><body><sec id="s1"><title>1. Introduction</title><p>One of the many problems that are considered to be NP-Hard is the Multiple Sequence Alignment one that initially requires, as for any other of its siblings, a specific encoding schema and design of the main functionalities of the heuristics algorithm being implemented and executed. This design was supported by references [<xref ref-type="bibr" rid="scirp.118127-ref1">1</xref>] [<xref ref-type="bibr" rid="scirp.118127-ref2">2</xref>] [<xref ref-type="bibr" rid="scirp.118127-ref3">3</xref>] and [<xref ref-type="bibr" rid="scirp.118127-ref4">4</xref>].</p><p>The main issue with that problem, as discussed in our ICeND2013 conference, was to come up with an encoding that would be suitable for the different Heuristics algorithms inspired by papers [<xref ref-type="bibr" rid="scirp.118127-ref5">5</xref>] [<xref ref-type="bibr" rid="scirp.118127-ref6">6</xref>] [<xref ref-type="bibr" rid="scirp.118127-ref7">7</xref>] [<xref ref-type="bibr" rid="scirp.118127-ref8">8</xref>] and [<xref ref-type="bibr" rid="scirp.118127-ref9">9</xref>]. Once the encoding is agreed on, the remaining part of designing and building the algorithm that will get a solution as close to the optimum as possible would be nonetheless as important. We have selected for our research to focus on the Simulated Annealing heuristic. However, we discovered that to be able to adjust some of the flaws of the standard algorithm, we improved it by adding functionalities like tracing the executions, so that later analysis could help better tune the initial parameters.</p><p>Papers [<xref ref-type="bibr" rid="scirp.118127-ref10">10</xref>] [<xref ref-type="bibr" rid="scirp.118127-ref11">11</xref>] [<xref ref-type="bibr" rid="scirp.118127-ref12">12</xref>] [<xref ref-type="bibr" rid="scirp.118127-ref13">13</xref>] come to prove the need for a generic and flexible implementation of Simulated Annealing with different tunable parameters.</p><p>In this paper, we’ll be discussing the implementation of the Simulated Annealing, with some modifications added to try to shorten the gap between the algorithm and the source that inspired it, which is the structure and behavior of metal cooling and shaping.</p></sec><sec id="s2"><title>2. Initial Algorithm</title>Standard Simulated Annealing<p>Simulated Annealing (SA) was initially designed to simulate the cooling of metals into crystalline structure (annealing process). Since the natural annealing process aims to minimize energy in resulting crystals, SA tackles problems from the point of view of minimizing cost/energy.</p><p>SA was intended in 1983 to be used with non-linear problems. “SA approaches the global maximization problem similarly to using a bouncing ball that can bounce over mountains from valley to valley.” [<xref ref-type="bibr" rid="scirp.118127-ref14">14</xref>] Initially, the temperature is set high enough so that this ball is given enough time to bounce, between and within valleys. The generic annealing algorithm/process suggests that, as time passes, the ball tends to get closer to its optimal location. Therefore, as the temperature cools down, the frequency of the large bounces (between valleys) tends to lower, while that of local bounces (within valleys) increases. However, to avoid falling in a local optimum valley, a probabilistic formula is applied, related to the current temperature gain and cost of bounce from the current location to a new one. In SA, the bounce (change in location) implies to perturb the current solution S into a new one S'. In the SA algorithm, the temperature parameter is denoted as T, and the number of moves (perturbations/bounces) is denoted by M. “It has been proved that by carefully controlling the rate of cooling of the temperature, SA can find the global optimum” [<xref ref-type="bibr" rid="scirp.118127-ref12">12</xref>]. This idea was also further supported by references [<xref ref-type="bibr" rid="scirp.118127-ref6">6</xref>] [<xref ref-type="bibr" rid="scirp.118127-ref7">7</xref>] and [<xref ref-type="bibr" rid="scirp.118127-ref15">15</xref>].</p></sec><sec id="s3"><title>3. Proposed Algorithm</title><p>The main idea behind Simulated Annealing was to simulate the annealing of metals, where the metal is mapped into an initial solution, and the atom moves mapped into moves to neighbor solutions, each of which is accepted, with a certain probability, if the cost of the neighbor solution is better than the current and best one found so far. The probability of accepting a solution is ≤a threshold value, directly proportional to the current temperature, and inversely to the difference in cost between the neighbor and current solutions. As the temperature cools down according to a given schedule, the algorithm is getting us closer to the optimal solution. Therefore, it allows the current solution to perturb more often. This process is repeatedly done for a given maximum number of moves, by applying the cooling rate α to the temperature, and motion rate β.</p><p>The steps of the below discussed algorithm are almost very similar to those of the basic standard algorithm, with the difference that some of them, highlighted in blue, offer the possibility to later on trace back each execution and allow better analysis, thus resulting in eventual update of initial parameters. The words/ fragments highlighted in green are more of structure and/or behavior enhancements that try to bridge the gap between the initial annealing process and our simulated annealing algorithm.</p><sec id="s3_1"><title>3.1. Main Procedure</title><p>The steps of the algorithm implemented are as follows:</p><p>Inputs: Initial Solution S<sub>0</sub>, Initial Temperature T<sub>0</sub>,</p><p>Cooling Rate α Motion Rate β</p><p>Initial number of moves M<sub>0</sub>,</p><p>Maximum Annealing time</p><p>Precondition: α &lt; 1 and β &gt; 1</p><p>Outputs: Optimal Solution BestS,</p><p>Algorithm:</p><p>Assign initial solution “S<sub>0</sub>” to current solution “CurS”</p><p>Assign initial temperature “T<sub>0</sub>” to current “T”</p><p>Assign initial number of moves “M<sub>0</sub>” to the current “M”</p><p>Assign “CurS” to optimal solution “BestS”</p><p>Compute cost of “CurS”, and save it in “CurCost”</p><p>Compute cost of “BestS”, and save it in “BestCost”</p><p>Initialize to zero the Annealing time “Time”</p><p>Repeat</p><p>Record, in global history, parameters: {CurS, BestS, T, M, Time}</p><p>Update parameters by calling: Metropolis procedure</p><p>on CurS, CurCost, BestS, BestCost, T, M.</p><p>Record in global history that of Metropolis execution</p><p>Include in Time number of moves done</p><p>Cool down temperature “T” according to rate “α”</p><p>Increment number of moves M according to rate “β”</p><p>Until “Time” ≥ “MaxTime”</p><p>Return “BestS”</p></sec><sec id="s3_2"><title>3.2. Metropolis Procedure</title><p>The steps and parts of the proposed algorithm are as follows, and visualized in <xref ref-type="fig" rid="fig1">Figure 1</xref>:</p><p>Inputs: Current Solution “CurS” Cost “CurCost”</p><p>Best Solution “BestS” Cost “BestCost”</p><p>Current Temperature “T” Current # Moves “M”</p><p>Outputs: ---</p><p>Algorithm:</p><p>Assign number of moves “M” to the current variable “Moves”</p><p>Repeat</p><p>Generate a solution neighbor “NewS” for “CurS”</p><p>Compute cost of “NewS”, and save it in “NewCost”</p><p>Record, in local history, parameters: {CurS, NewS, BestS}</p><p>Compute “DeltaCost” = “NewCost” – “CurCost”</p><p>If “DeltaCost” &lt; 0 then</p><p>{{“NewS” has lower cost than “CurS”}}</p><p>Assign New solution and cost to current</p><p>If NewCost &lt; BestCost then</p><p>{{NewS has lower cost than BestS}}</p><p>Assign the New solution and cost to best</p><p>Else</p><p>{{“NewS” is higher than that of “CurS”}}</p><p>If random() &lt; 1 / e<sup>(DeltaCost/T)</sup> then</p><p>Assign new solution and cost to current structure and value</p><p>Decrement the value of “Moves” by 1</p><p>Until “Moves” = 0</p><p>Per simulation iteration, the Metropolis procedure computes M neighbor solutions. Like the “Cost” method, the “Neighbor” function is problem specific. Every problem that needs to run Simulated Annealing needs to implement both “Cost” and “Neighbor”.</p><p>Below is an algorithm that helps tune the initial temperature parameter of the Simulated Annealing, according to the standard and simple cooling schedule.</p></sec><sec id="s3_3"><title>3.3. Tuning Initial Temperature Procedure</title><p>Inputs: Current Solution “CurS” Cost “CurCost”</p><p>Starting Temperature “T” # Moves Attempt “M”</p><p>Result Tolerance “Threshold”</p><p>Outputs: Initial Temperature “T<sub>0</sub>”,</p><p>Algorithm:</p><p>Assign starting temperature “T” to initial “T<sub>0</sub>”</p><p>Assign value of 1 – “Threshold” to variable “TD”</p><p>Do</p><p>Assign number of moves “M” to # trials “Attempted”</p><p>Initialize to zero # accepted moves “Accepted”</p><p>Assign number of moves “M” to current “Moves”</p><p>Repeat</p><p>Generate a solution neighbor “NewS” for “CurS”</p><p>Compute cost of “NewS”, and save it in “NewCost”</p><p>Compute “DeltaCost” = “NewCost” – “CurCost”</p><p>If “DeltaCost” &lt; 0 then</p><p>Assign new solution and cost to current structure and value</p><p>Increment “Accepted” by 1 move</p><p>Else-If random() &lt; e<sup>(DeltaCost/T)</sup> then</p><p>Assign new solution and cost to current structure and value</p><p>Increment “Accepted” by 1 move</p><p>Decrement the value of “Moves” by 1 move</p><p>Until “Moves” = 0</p><p>Compute ratio “Ratio” = “Accepted” / “Attempted”</p><p>While “Ratio” ≥ “TD”</p><p>Return “T<sub>0</sub>”</p></sec><sec id="s3_4"><title>3.4. Mathematical Design</title><p>Customized Simulated Annealing</p><p>Various cooling schedules, mentioned later, can be used with a Simulated Annealing optimization. Let T<sub>i</sub> be the temperature for iteration i, where i increases from 1 to N. The number of iterations is indirectly determined by the user through: MaxTime.</p><p>This customized SA algorithm computes the number of cooling down iterations, beforehand, and tries to make each one as independent of the others as possible. Thus, the temperature, number of moves and time should be as unrelated as possible to the respective values computed in previous iterations.</p><p>Let t i be the time elapsed up to iteration i, and M i the number of moves for this iteration.</p><p>t i = { t i − 1 + M i − 1 if   1 &lt; i ≤ N M 0 if   i = 1</p><p>where: M i = β * { M i − 1 if   1 &lt; i ≤ N M 0 if   i = 1</p><p>M i = β i M 0     for     i = 1 , 2 , ⋯ , N</p><p>t 1 = M 0</p><p>t 2 = t 1 + M 1 ⇒ t 2 = M 0 + M 1 ⇒ t 2 = ( 1 + β ) * M 0</p><p>t 3 = t 2 + M 2 ⇒ t 3 = ( 1 + β ) * M 0 + M 2 ⇒ t 3 = ( 1 + β + β 2 ) * M 0</p><p>t 4 = t 3 + M 3 ⇒ t 4 = ( 1 + β + β 2 ) * M 0 + M 3 ⇒ t 4 = ( 1 + β + β 2 + β 3 ) * M 0</p><p>Similarly:</p><p>t k = M 0 * ∑ j = 0 k − 1 β j ⇒ t k = ( β k − 1 β − 1 ) * M 0     for   k = 1 , 2 , ⋯ , N</p><p>At the end of the simulation– t N = M a x T i m e</p><p>M a x T i m e = ( β N − 1 β − 1 ) * M 0 ⇒ ( β N − 1 ) = ( β − 1 ) * M a x T i m e M 0</p><p>Then:</p><p>β N = 1 + ( β − 1 ) * M a x T i m e M 0 ⇒ N = I n t e g e r ( log β { 1 + ( β − 1 ) * M a x T i m e M 0 } )</p><p>Therefore:</p><p>N = I n t e g e r ( 1 ln ( β ) * ln ( 1 + M a x T i m e * ( β − 1 ) M 0 ) )</p><p>The different schedules, implemented in the following cooling schedule, are illustrated in <xref ref-type="table" rid="table1">Table 1</xref>. These schedules are used in the customized algorithm by referring to the corresponding code, which is an integer value between 1 and 9. For flexibility reasons, code 10 is left to allow the algorithm to handle any externally defined schedule.</p></sec><sec id="s3_5"><title>3.5. Main Procedure</title><p>Inputs: Initial Solution “S<sub>0</sub>” Cooling Schedule “code”</p><p>Initial Temperature “T<sub>0</sub>” Total cooling Rate “R”</p><p>Motion Rate “β” Initial # moves “M<sub>0</sub>”</p><p>Maximum Annealing time “MaxTime”</p><p>Precondition: “R” &lt; 1 “β” &gt; 1</p><p>“code” corresponds to one of the schedules of <xref ref-type="table" rid="table1">Table 1</xref></p><p>Outputs: Optimal Solution “BestS”</p><p>Algorithm:</p><p>Assign initial solution “S<sub>0</sub>” to current “CurS”</p><p>Assign initial temperature “T<sub>0</sub>” to current “T”</p><p>Assign initial number of moves “M<sub>0</sub>” to current “M”</p><p>Assign current solution “CurS” to optimal “BestS”</p><p>Compute cost of “CurS”, and save it in “CurCost”</p><p>Compute cost of “BestS”, and save it in “BestCost”</p><p>Apply the above mentioned formula for “N”</p><p>For i from 1 to “N” do</p><p>Record, in global history, parameters {CurS, BestS, T, M, Time}</p><p>Update parameters by calling Metropolis</p><p>on {CurS, CurCost, BestS, BestCost, T, M}</p><p>Record in global history that of Metropolis execution</p><p>Assign to “T” result of calling CoolingSchedule on (code, i, N, R, T<sub>0</sub>)</p><p>Set value of “M” as “M<sub>0</sub> * Power (β, i)”</p><p>Return “BestS”</p><p>In comparison with the standard S.A algorithm, this algorithm allows the simulation to occur with a non-scalar cooling schedule, by specifying the code of the cooling schedule. One difference is the absence of the time variable replaced by a loop-iteration index. Another difference is the fact that the temperature and the number of moves are computed independently of previous iterations, but according to the iteration index and some other parameters. Since the global</p><table-wrap id="table1" ><label><xref ref-type="table" rid="table1">Table 1</xref></label><caption><title> Some suggested cooling schedules</title></caption><table><tbody><thead><tr><th align="center" valign="middle" >Code</th><th align="center" valign="middle" >Name</th><th align="center" valign="middle" >Graph</th><th align="center" valign="middle" ></th><th align="center" valign="middle"  colspan="2"  ></th><th align="center" valign="middle" ></th></tr></thead><tr><td align="center" valign="middle" >1</td><td align="center" valign="middle" >Linear</td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="/html.scirp.org/file/12-2311707x17.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" >2</td><td align="center" valign="middle"  colspan="2"  >Scalar</td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="/html.scirp.org/file/12-2311707x18.png" xlink:type="simple"/></inline-formula></td></tr><tr><td align="center" valign="middle" >3</td><td align="center" valign="middle" >Hyperbolic</td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="/html.scirp.org/file/12-2311707x19.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" >4</td><td align="center" valign="middle"  colspan="2"  >Exp.</td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="/html.scirp.org/file/12-2311707x20.png" xlink:type="simple"/></inline-formula></td></tr><tr><td align="center" valign="middle" >5</td><td align="center" valign="middle" >Sigmoid</td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="/html.scirp.org/file/12-2311707x21.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" >6</td><td align="center" valign="middle" >Cos</td><td align="center" valign="middle"  colspan="2"  ><inline-formula><inline-graphic xlink:href="/html.scirp.org/file/12-2311707x22.png" xlink:type="simple"/></inline-formula></td></tr><tr><td align="center" valign="middle" >7</td><td align="center" valign="middle" >Tanh</td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="/html.scirp.org/file/12-2311707x23.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" >8</td><td align="center" valign="middle" >Cosh</td><td align="center" valign="middle"  colspan="2"  ><inline-formula><inline-graphic xlink:href="/html.scirp.org/file/12-2311707x24.png" xlink:type="simple"/></inline-formula></td></tr><tr><td align="center" valign="middle" >9</td><td align="center" valign="middle" >Squared Scalar</td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="/html.scirp.org/file/12-2311707x25.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle"  colspan="2"  ></td></tr><tr><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td></tr></tbody></table></table-wrap><p>initialization phase was replaced by an iteration initialization, we have instead of i. This algorithm uses the Metropolis procedure defined above by the Standard Simulated Annealing procedure.</p></sec><sec id="s3_6"><title>3.6. Cooling-Schedule Procedure</title><p>Inputs: Cooling Schedule “code” Current Iteration Index “i”</p><p>Number of Cooling Steps “N” Initial Temperature “T<sub>0</sub>”</p><p>Precondition:</p><p>“code” corresponds to one of the schedules of <xref ref-type="table" rid="table1">Table 1</xref></p><p>Outputs:</p><p>Current Temperature “T”</p><p>Algorithm:</p><p>Case “code” is</p><p>1: Return T 0 − [ i * ( 1 − R ) N ]</p><p>2: Return T 0 * R i N</p><p>3: Return T 0 * [ ( 1 − R ) ( N + 1 ) N ( i + 1 ) + R ( N + 1 ) − 1 N ]</p><p>4: A = ln ( T 0 * ( 1 − R ) ) ln ( N )</p><p>Return T 0 − i A</p><p>5: A = 0.3 * ( i − N 2 )</p><p>Return T 0 * [ ( 1 − R ) 1 + e A + R ]</p><p>6: Return ( T 0 2 ) * [ 1 + R + { ( 1 − R ) * C o s ( π * i N ) } ]</p><p>7: Return ( T 0 2 ) * [ 1 + R − { ( 1 − R ) * T a n h ( 10 i N − 5 ) } ]</p><p>8: Return T 0 * [ ( 1 − R ) * S e c h ( 10 i N ) ]</p><p>9: A = ( i N ) 2</p><p>Return T 0 * R A</p><p>10: T = C u s t o m i z e d C o o l i n g S c h e d u l e ( i , N , R , T 0 )</p><p>If T &lt; T<sub>0</sub> then</p><p>Return T</p><p>Return c o o l i n g S c h e d u l e ( 2 , i , N , R , T 0 )</p></sec><sec id="s3_7"><title>3.7. Customized-Cooling-Schedule Procedure</title><p>Inputs: Current Iteration Index “i” Number of Cooling Steps “N”</p><p>Total cooling Rate “R” Initial Temperature “T<sub>0</sub>”</p><p>Precondition:</p><p>“code” corresponds to one of the schedules of <xref ref-type="table" rid="table1">Table 1</xref></p><p>Outputs:</p><p>Current Temperature “T”</p><p>Algorithm:</p><p>The implementation of this algorithm is left for the algorithm or context inheriting from this generic implementation.</p></sec><sec id="s3_8"><title>3.8. Object-Oriented Procedure</title><p>The class diagram of our generic algorithm seems simple, as shown in <xref ref-type="fig" rid="fig2">Figure 2</xref>, because the genericity itself lies in the implementation of the different methods of the main component used in the algorithm.</p><p>The base “SAProblem” component represents the environment offering the possible values and functionalities that the main algorithm’s steps will be relying on to execute generic global and specific tasks.</p><p>The second class (in the middle), is the class representation that will be holding the values of the encoded solution.</p><p>The third component is the main algorithm offering both flexibility and execution tracing, by saving into current instance variables and some inherited properties a specific set of values per iteration while running.</p><p>Since we are talking about a generic implementation of the algorithm and its components, we implemented a few problems, as shown in <xref ref-type="fig" rid="fig3">Figure 3</xref> and <xref ref-type="fig" rid="fig4">Figure 4</xref>, which follow the guidelines set by the components diagrams of <xref ref-type="fig" rid="fig2">Figure 2</xref>; but also by the suggested encoding in reference paper 1, trying to cover different complexities. This set is divided into 3 groups relating all to a base class holding the math formulas: the first group is working with {2, 8, 10 and 16} radix applied to the default “Formula01” functionality; while the second group is a collection of problems handling different math formulas. The last group is the implementation of the encoding suggested in reference paper 1 about phylogenies.</p><p>In order to illustrate the generic implementations applied on these problems, we have developed a quick straight forward windows application, in which we dynamically modified the parameters of a default algorithm based on the suggested generic implementation, instead of writing many versions inheriting for our main implementation.</p><p>The first step, <xref ref-type="fig" rid="fig5">Figure 5</xref>, is to specify which problem the algorithm will work on. This list of problems is dynamically built from the set of problems included in the package, not only the one discussed above.</p><p>The second step, <xref ref-type="fig" rid="fig6">Figure 6</xref>, would be to specify some of the properties required by the algorithm. The problem itself has no parameters, since the real action lies in the algorithm’s method. Even though default values were given to those parameters, we advise to modify them to be able to view effective results, and/or test different cooling schedules.</p><p>The third and final step, as shown in <xref ref-type="fig" rid="fig7">Figure 7</xref>, is to simply run the algorithm. In the above screenshot, we are showing the generated result of an execution on</p><p>problem Pb001, along with the actual value corresponding to the last current solution compared to the cost evaluated during the last iteration of the algorithm. The next section of the screen shows the optimal solution it was able to detect with a cost of 0, which is mathematically the actual best cost. For more complex problems, running the algorithm for more time will most probably change the best cost value converging towards a more suitable optimum.</p><p>Tracing back the execution of the execution mentioned we can see in <xref ref-type="fig" rid="fig8">Figure 8</xref> that the algorithm reached 80377 as the best solution at the end of the initial step.</p><p>As illustrated in <xref ref-type="fig" rid="fig9">Figure 9</xref>, while looking in more depth at the changes and switching between current and best solutions over iterations of the main and of the metropolis procedures, we have to highlight the fact that different cooling schedule will yield arrival to the optimum at various steps. Thus allowing us to tune and select a more suitable cooling schedule for later runs.</p></sec></sec><sec id="s4"><title>4. Conclusions</title><p>This research can be developed by trying to design and implement solutions to the below issues raised during our research, and supported by references [<xref ref-type="bibr" rid="scirp.118127-ref16">16</xref>] [<xref ref-type="bibr" rid="scirp.118127-ref17">17</xref>] [<xref ref-type="bibr" rid="scirp.118127-ref18">18</xref>] [<xref ref-type="bibr" rid="scirp.118127-ref19">19</xref>] [<xref ref-type="bibr" rid="scirp.118127-ref20">20</xref>] but also [<xref ref-type="bibr" rid="scirp.118127-ref21">21</xref>] [<xref ref-type="bibr" rid="scirp.118127-ref22">22</xref>] [<xref ref-type="bibr" rid="scirp.118127-ref23">23</xref>]:</p><p>➢ Fixed Input Parameters:</p><p>&#174; Even with a parameters tuning {initial temperature T<sub>0</sub>, motion and cooling rates and initial number of jumps M<sub>0</sub>, among others}, we still end up with fixed values for the algorithm’s inputs.</p><p>➢ Randomness doesn’t handle potentially repetitions:</p><p>&#174; In Neighbor method</p><p>➢ Initial solution may be far from the optimal one, thus the algorithm will take more time.</p><p>➢ Different cooling schedules might give better results than others at times and less good at other times; thus we will need to have a comprehensive and flexible schedule, or a functionality allowing us to run different schedules at different iterations.</p></sec><sec id="s5"><title>Conflicts of Interest</title><p>The authors declare no conflicts of interest regarding the publication of this paper.</p></sec><sec id="s6"><title>Cite this paper</title><p>Kallab, C., Haddad, S., Sayah, J. and Chakroun, M. (2022) Generic Simulated Annealing. Open Journal of Applied Sciences, 12, 1011-1025. https://doi.org/10.4236/ojapps.2022.126069</p></sec></body><back><ref-list><title>References</title><ref id="scirp.118127-ref1"><label>1</label><mixed-citation publication-type="other" xlink:type="simple">Kallab, C. (2013) Generic Encoding and Phylogenies. Proceedings of the ICeND 2013 Conference, Kuala Lumpur, 4-6 March 2013, 142.</mixed-citation></ref><ref id="scirp.118127-ref2"><label>2</label><mixed-citation publication-type="other" xlink:type="simple">Kim, J. and Warnow, T. (1999) Tutorial on Phylogenetic Tree Estimation. https://www.semanticscholar.org/paper/Tutorial-on-Phylogenetic-Tree-Estimation-Kim/aa81aac8c1e762196e36ae8169fe20980f294fd1</mixed-citation></ref><ref id="scirp.118127-ref3"><label>3</label><mixed-citation publication-type="other" xlink:type="simple">Moret, B., Bader, D. and Warnow, T. (2002) High-Performance Algorithm Engineering for Computational Phylogenetics. Journal of Supercomputing, 22, 99-111.https://www.mendeley.com/catalogue/f94b325a-d512-34d1-8335-b735011b1cf0</mixed-citation></ref><ref id="scirp.118127-ref4"><label>4</label><mixed-citation publication-type="other" xlink:type="simple">Opper, D. Parsimony Phylogenetic Trees. http://www.icp.ucl.ac.be/~opperd/private/parsimony.html</mixed-citation></ref><ref id="scirp.118127-ref5"><label>5</label><mixed-citation publication-type="other" xlink:type="simple">Stamatakis, A., Ott, M. and Ludwig, T. (2005) RAxML-OMP: An Efficient Program for Phylogenetic Inference on SMPs. International Conference on Parallel Computing Technologies, Krasnoyarsk, 5-9 September 2005, 288-302. https://www.researchgate.net/publication/221185791_RAxML-OMP_an_efficient_program_for_phylogenetic_inference_on_SMPs https://doi.org/10.1007/11535294_25</mixed-citation></ref><ref id="scirp.118127-ref6"><label>6</label><mixed-citation publication-type="other" xlink:type="simple">Thinkquest 2001: International Internet Challenge. Genetic Engineering, the Creation Website. https://link.springer.com/article/10.1023/A:1013193211174</mixed-citation></ref><ref id="scirp.118127-ref7"><label>7</label><mixed-citation publication-type="other" xlink:type="simple">Felsenstein, J. (1982) Numerical Methods for Inferring Evolutionary Trees. The Quarterly Review of Biology, 57, 379-404. https://doi.org/10.1086/412935</mixed-citation></ref><ref id="scirp.118127-ref8"><label>8</label><mixed-citation publication-type="other" xlink:type="simple">Fitch, W. (1971) Toward Defining the Course of Evolution: Minimum Change for a Specified Tree Topology. Systematic Zoology, 20, 406-416. https://doi.org/10.2307/2412116</mixed-citation></ref><ref id="scirp.118127-ref9"><label>9</label><mixed-citation publication-type="other" xlink:type="simple">Hendy, M.D. and Penny, D. (1982) Branch and Bound Algorithms to Determine Minimal Evolutionary Trees. Mathematical Biosciences, 59, 277-290.https://www.sciencedirect.com/science/article/abs/pii/002555648290027X https://doi.org/10.1016/0025-5564(82)90027-X</mixed-citation></ref><ref id="scirp.118127-ref10"><label>10</label><mixed-citation publication-type="other" xlink:type="simple">Aarts, E.H.L. (1989) Simulated Annealing: An Introduction. Statistica Neerlandica, 43, 31-52. https://doi.org/10.1111/j.1467-9574.1989.tb01245.x</mixed-citation></ref><ref id="scirp.118127-ref11"><label>11</label><mixed-citation publication-type="other" xlink:type="simple">Davis, L. (1987) Genetic Algorithms and Simulated Annealing.</mixed-citation></ref><ref id="scirp.118127-ref12"><label>12</label><mixed-citation publication-type="other" xlink:type="simple">Ingber, L. (1993) Simulated Annealing: Practice versus Theory. Mathematical and Computer Modelling, 18, 29-57. https://doi.org/10.1016/0895-7177(93)90204-C</mixed-citation></ref><ref id="scirp.118127-ref13"><label>13</label><mixed-citation publication-type="other" xlink:type="simple">Locatelli, M. (2000) Simulated Annealing Algorithms for Continuous Global Optimization: Convergence Conditions. Journal of Optimization Theory and Applications, 104, 121-133. https://doi.org/10.1023/A:1004680806815</mixed-citation></ref><ref id="scirp.118127-ref14"><label>14</label><mixed-citation publication-type="other" xlink:type="simple">Pandey, A., Banerjee, S. and Sahoo, G. (2014) Applications of Meta Heuristic Search Algorithms in Software Testing: An Investigation into Recent Trends. Advances in Computer Science and Information Technology, 1, 61-64.</mixed-citation></ref><ref id="scirp.118127-ref15"><label>15</label><mixed-citation publication-type="other" xlink:type="simple">Affenzeller, M. and Mayrhofer, R. (2004) Generic Heuristics for Combinatorial Optimization Problems. https://www.researchgate.net/publication/2902641_Generic_Heuristics_for_Combinatorial_Optimization_Problems</mixed-citation></ref><ref id="scirp.118127-ref16"><label>16</label><mixed-citation publication-type="other" xlink:type="simple">Sharman, K.C. (1988) Maximum Likelihood Parameter Estimation by Simulated Annealing. ICASSP-88, International Conference on Acoustics, Speech, and Signal Processing, Volume 1, 2741-2744.</mixed-citation></ref><ref id="scirp.118127-ref17"><label>17</label><mixed-citation publication-type="other" xlink:type="simple">Fleischer, M. (1995) Simulated Annealing: Past, Present, and Future. Winter Simulation Conference Proceedings, Arlington, 3-6 December 1995.</mixed-citation></ref><ref id="scirp.118127-ref18"><label>18</label><mixed-citation publication-type="other" xlink:type="simple">Yao, X. and Li, G. (1991) General Simulated Annealing. Journal of Computer Science and Technology, 6, 329-338. https://doi.org/10.1007/BF02948392</mixed-citation></ref><ref id="scirp.118127-ref19"><label>19</label><mixed-citation publication-type="other" xlink:type="simple">Suppapitnarm, A., Seffen, K.A., Parks, G.T. and Clarkson, P.J. (2007) A Simulated Annealing Algorithm for Multiobjective Optimization. Engineering Optimization, 33, 59-85. https://doi.org/10.1080/03052150008940911</mixed-citation></ref><ref id="scirp.118127-ref20"><label>20</label><mixed-citation publication-type="other" xlink:type="simple">Kim, J., Pramanik, S. and Chung, M.J. (1994) Multiple Sequence Alignment Using Simulated Annealing. Bioinformatics, 10, 419-426. https://doi.org/10.1093/bioinformatics/10.4.419</mixed-citation></ref><ref id="scirp.118127-ref21"><label>21</label><mixed-citation publication-type="other" xlink:type="simple">Yang, W.B. and Wang, Y.D. (2012) Improved Simulated Annealing Algorithm for GTSP. International Conference on Automatic Control and Artificial Intelligence (ACAI), Xiamen, 3-5 March 2012, 1202-1205.</mixed-citation></ref><ref id="scirp.118127-ref22"><label>22</label><mixed-citation publication-type="other" xlink:type="simple">Khairuddin, R. and Zainuddin, Z.M. (2019) A Comparison of Simulated Annealing Cooling Strategies for Redesigning a Warehouse Network Problem. Journal of Physics Conference Series, 1366, Article ID: 012078. https://doi.org/10.1088/1742-6596/1366/1/012078</mixed-citation></ref><ref id="scirp.118127-ref23"><label>23</label><mixed-citation publication-type="other" xlink:type="simple">Peprah, A.K., Appiah, S.K. and Amponsah, S.K. (2017) An Optimal Cooling Schedule Using a Simulated Annealing Based Approach. Applied Mathematics, 8, 1195-1210. https://doi.org/10.4236/am.2017.88090</mixed-citation></ref></ref-list></back></article>