Natural language understanding for logical games

We developed a system able to automatically solve logical puzzles in natural language. Our solution is composed by a parser and an inference module. The parser translates the text into first order logic (FOL), while the MACE4 model finder is used to compute the models of the given FOL theory. We also empower our software agent with the capability to provide Yes/No answers to natural language questions related to each puzzle. Moreover, in line with Explainalbe Artificial Intelligence (XAI), the agent can back its answer, providing a graphical representation of the proof. The advantage of using reasoning for Natural Language Understanding (NLU) instead of Machine learning is that the user can obtain an explanation of the reasoning chain. We illustrate how the system performs on various types of natural language puzzles, including 382 knights and knaves puzzles. These features together with the overall performance rate of 80.89\% makes the proposed solution an improvement upon similar solvers for natural language understanding in the puzzles domain.

I. INTRODUCTION
Here is a puzzle for you: There are three friends staying on the couch in Central Perk: Rachel, Ross, and Monica. Monica is looking at Ross. Ross is looking at Rachel. Monica is married; Rachel is not. Is a married person looking at an unmarried person? [1] (Figure 1). The answer may seem difficult since we do not know if Ross is married or not. A fan of the "Friends" series would know that even Ross has some difficulties to figure out if he is married or not.
Yet, such puzzles are easy to solve for theorem provers, given the proper formalisation. Take for instance the given facts in first order logic (FOL): looking(M onica, Ross) ¬married (Rachel) looking(Ross, Rachel) The theorem to prove: ∃x ∃y (married(x) ∧ ¬married(y) ∧ looking(x, y)) (1) is easily demonstrated by resolution-based theorem provers. The challenge remains how to translate the text of the puzzle from natural language to first order logic.
Building a system that can understand the natural language as well as a human is considered a "too hard" AI problem [2], since an exact understanding of all clues is necessary to figure out the solution. Barrière views language understanding as a transformation of text into a deeper representation, one on which reasoning can occur [3]. In this line, we argue here that

Rachel
Ross Monica I am in a break! I am not married I am married solving logical puzzles by machines is a powerful and relevant test to illustrate natural language understanding. For a software agent, solving such puzzles raises two main challenges: i) translating the text from natural language to some logical representation; and ii) reasoning on that formalisation to infer the solution. Also, in most of the cases, background knowledge is required to solve the puzzle (e.g. the married relation is symmetric married(x, y) ↔ married(y, x), and functional married(x, y) ∧ married(x, y) → y = z). What distinguishes puzzles from classical tasks in natural language understanding is their nice property: each piece of information provided in the text is required. Hence, a good puzzle provides no text which is not useful. Differently from tasks from the knowledge representation domain in which there is a lot of knowledge (e.g. large ontologies, big data) and little reasoning, here puzzles require knowledge and reasoning in similar proportions.
We present a solver for logical puzzles in natural language. We rely on grammar rules and lexical resources such as Wordnet [4]. The text is automatically translated into FOL using the NLTK [5] and then given to the theorem prover Prover9 and model finder Mace4 [6].

II. SYSTEM OVERVIEW
The input of this system consists of the puzzle to be solved, in natural language. The solver 1 follows four steps ( Figure 2). First, we have to build the context-free grammar which contains the lexicon and the grammar. Second, the text is translated into FOL. Third, we add the background knowledge for the given domain (i.e. knights and knaves puzzles). Fourth, a model builder (in our case, Mace4) is called to compute the solutions.

A. Building the grammar
Consider the following small puzzle: Diana is taller than Maria. Ana is taller than Diana. Who is the shortest? The grammar for such puzzles contains both lexical and grammar rules: Lexical rules hold the linguistic categories for each puzzle (Listing 1). A custom encoding is defined for every category (e.g. N for noun, VT for transitive verbs, IV for intransitive verbs). Every word has to belong to such a category and can have one or more features [7]. Two of the most important features used by the solver are named SEM, which is used to specify the semantics of the word and NUM, which can be used to define the number of a noun (i.e. which can have a value like sg for singular or pl for plural). Thus, an invalid sentence as "These dog barks" cannot be parsed. To assess the correctness of sentences, we also included features like PERS for distinguish the person, or TENSE for verb tenses.
The most important feature is the one for defining the semantics of the words. The values of the SEM feature are computed based on λ-calculus. For example, the expression \x.(walk(x) & chew gum(x)) represents the entities that both walk and chew gum. If we apply this expression to a person named Gerald, we obtain the expression nx.(walk(x)&chew gum(x))(gerald), which is equivalent to the expression walk(gerald)&chew gum(gerald), meaning that Gerald walks and chews gum. The lambda operator is essential in connecting different words. s h o r t e s t ' 14 P [ + t h a n ] −> ' t h a n ' Grammar rules define, in a recursive way, how words from different parts of speech are connected ). The rules in Listing 1 were manually crafted for the application domain. These sequences of words are grouped into chunks. An example of such a chunk is the noun phrase chunk, which can be exemplified by expresions like "the man" or "the red ball". Unlike the words in lexical rules, which can be considered terminals, the chunks are nonterminals. A grammar is contextfree if the left side of its rules are only nonterminals, whereas the right-hand side can be a combination of terminals and nonterminals.
Important for consistency and generalization is the usage of variables as values for features. Thus, using a wildcard operator, we can define a rule like which says that the feature N U M of both A and B must have the same value, so we can control the correctness of a sentence. Note that the context-free grammar in Listing 2 can parse sentences such as "Kevin is taller than Diana" or "Maria is the tallest", but not "Maria are the tallest".

B. Translating to First-Order Logic
We start the translation mechanism with the coreference resolution, followed by parsing based on the grammars previously built.
Coreference resolution aims to make a connection between different expressions from the text and the corresponding entities (e.g. the pronoun he with the corresponding person that the pronoun refers to). Failing to achieve coreference resolution leads to failure in solving the puzzle, as some information would be omitted or interpreted in a wrong way. For this task we rely on the Neuralcoref module based on the spaCy parser [8].
Next, we obtain a tree representation for every sentence in the updated puzzle. The representation of every sentence in FOL is obtained from the previously defined SEM feature, which is stored in the parse trees. The lexicon is automatically extended with all the synonyms offered by the Wordnet lexical database, so that a word without definition in the grammar file but with a synonym defined in the grammar file can be successfully parsed. The "unseen" word will take all the attributes from the synonym found in the grammar file, so there is no difference between the parsing result of a sentence containing unseen words and the one containing only predefined words.
As an example, let the following puzzle: Puzzle 1: On the island where each inhabitant is either a knave or a knight , knights always tell the truth while knaves always lie. You meet two inhabitants: Marge and Homer. Marge says that Homer and she are both knights or both knaves. Homer claims that Marge and he are the same. Can you determine who is a knight and who is a knave? (Figure 3). Figure 4 shows the parse tree for the first sentence. Note that there are some words whose semantics are not considered when the representation in FOL has to be obtained, like the pronoun "You" or the transitive verb "meet". By using the grammar rules the first sentence is translated into FOL as three clauses: The sentence Marge says that Homer and Marge are both knights or both knaves is formalised with: The clue Homer claims that Marge and Homer are the same is formalised with: (claim(homer) ↔ same(homer, marge)) One of the system features, in contrast to other existing solvers, is the ability to distinguish, for example, between the person names from the puzzle. Thus, the user does not need to specify, by himself, who are the named entities in the puzzle he wants to solve. Recognising the named entities was achieved by the spaCy library, using a trained existing pipeline in order to get a label for the discovered named entities by making a prediction. The task in our example is to retrieve the existing persons in the puzzle. Since the unique name assumption does not hold by default in FOL, we explicitly state the distinctions between names (e.g. alice = sam).

C. Adding background knowledge
Although for a human agent the task of figuring out the additional knowledge needed to reach a solution is an easy one, for the software agent it is challenging [9].
For each word in the puzzle, we extract from the WordNet the set of synonyms. Then, we check if any synonym from the set coexists in the specified text. If so, we formalise in FOL the equivalence (e.g. ∀x (say(x) ↔ tell(x))). When extracting the synonyms we considered the part of speech also. For example, the word "state" can be both a noun (e.g country) or a verb (as a synonym for "say"). Both of these two words are valid synonyms, but in different contexts. Therefore, we determine the POS in the current context and consider just the synonyms which have the same tag. To avoid building some assumptions which refer to the same words, but in different forms (like ∀x (say(x) ↔ tell(x)) and ∀x (says(x) ↔ tell(x))), lemmatization is applied.
There exists, however, some contextual meaning that depends on the puzzle domain. For instance, in the puzzles of knights and knaves, the sentence "Alice and Sam are the same", requires the proper formalisation for the predicate "same": The domain knowledge for the knight and knaves puzzles states also that there are only knights and knaves: The above tiny background knowledge for the knights and knaves domain was also manually crafted.

D. Computing the solution
In the final step, the Mace4 model builder computes the solution. Mace4 uses the FOL representation of the puzzle to compute a model for the given FOL theory. For example, Mace4's solution for the Puzzle 1 appears in Figure 5.
Using a model finder to answer the puzzle is not necessarily an obvious choice since the constraints could have more than one model. However, fa good puzzle should have sufficient constraints to ensure that the answer to the question does not depend on the choice of model.

E. Question answering and explainability
We empower our solver, with two interesting features: i) question answering (QA) -the capacity to answer various natural language questions from the puzzle, and ii) explainability (XAI)-the capability to provide graphical proofs for each answer provided. For these features we used Prover9 to provide Yes/No answers and graphical representation of the proofs for each answer.
For exemplifying the question answering capability consider the following puzzle: Puzzle 2: On the island where each inhabitant is either a knave or a knight, knights always tell the truth while knaves always lie. You meet two inhabitants: Sue and Alice. Sue claims that Alice is a knave. Alice says that she and Sue are knights.
First, the solver uses named entity resolution to identify the two persons Sue and Alice. Hence the domain size is set to two elements. Then the correference resolution figures out that the pronoun "she" refers to Alice in the sentence: "Alice says that she and Sue are knights." The Wordnet is used to identify that "claims and "says" are synonyms, thus adding this piece of knowledge in the FOL theory. The FOL theory built using the grammar file, the domain size, and the background knowledge is given to MACE4, which finds valid instantiations for each element in the theory. The user can ask questions like: Is Sue a knight? Does Alice lie? Is Alice a knave? Are Alice and Sue different? Are Alice and Sue the same? Are Alice and Sue both knights? The same grammar file is used to parse the queries and to translate them as theorems in First Order Logic. The theorem is given to Prover9 which provides a YES/No answer. Figure 6 shows the proof for the theorem "Marge and Mel are knights". There are assumptions from text (line 4) or from synonymy between words (line 12), while the goal appears in line 14. Some clauses represent disjunctions of literals deduced from assumptions (line 42). Based on resolution, new clauses inferred (e.g. line 68), until the empty clause is deduced which signals that the theorem is proved.
For each Yes/No computed answer, the system outputs a graphical representation of the proof. To illustrate this feature, consider the following puzzle.
Puzzle 3: On the island of knights and knaves, knights always tell the truth, while knaves always lie. You are approached by two people. The first one says: "We are both knaves". Consider also the compound query: Is the first inhabitant a knave and the second one a knight? The corresponding FOL theory appears in Listing 3.
First, the inhabitants are either knights or knaves: Second, one cannot be a knight and a knave in the same time: ∀x ((knight(x) → ¬knave(x))∧(knave(x) → ¬knight(x))). (13) Third, a message m(x) said by a knight x is always true: knight(x) → m(x). Fourth, a message m(x) said by a knave x is always false: knave(x) → ¬m(x). These pieces of knowledge represent background knowledge for all knights and knaves puzzles Next, we formalise the current puzzle. We learn that there are two inhabitants, let's say a and b: inhabitant(a) ∧ inhabitant(b). We need a domain size of two individuals. The message of inhabitant a is: m(a) ↔ knave(a) ∧ knave(b).

III. RUNNING EXPERIMENTS
We evaluate the solver on a dataset of 382 puzzles with knights and knaves 2 . The complexity of these puzzles is variable, starting with puzzles with two individuals (such as Puzzle 1), continuing with puzzles with more text and persons such as Puzzle 4. As a measure of complexity, the puzzles can be classified based on the number of inhabitants: there are 50 puzzles each with two, three, four, five, six, seven and eight inhabitants, and 32 puzzles having nine inhabitants. 2 Puzzles are taken from the website https://philosophy.hku.hk/think/logic/knights.php Puzzle 4: "On the island where each inhabitant is either a knave or a knight, knights always tell the truth while knaves always lie. You meet nine inhabitants: Carl, Betty, Ted, Dave, Marge, Alice, Rex, Bob and Sally. Carl claims that Ted would tell you that Alice is a knave. Betty says that at least one of the following is true: that Ted is a knave or that Dave is a knave. Ted says that Rex could say that Betty is a knave. Dave claims that Sally and Alice are different. Marge says that Rex is a knave. Alice claims that Carl is a knave or Sally is a knight. Rex says that he knows that he is a knight and that Bob is a knave. Bob says that he and Rex are both knights or both knaves. Sally tells you that Bob is a knave. Can you determine who is a knight and who is a knave?" We start by formalising the context-free grammar file by analysing 43 puzzles of different complexities, including 20 puzzles with two inhabitants, 5 puzzles with 3 inhabitants, and 3 puzzles each with four, five, six, seven, eight and nine inhabitants. The remaining 339 unseen puzzles were used to test the grammar.
In our experiments, first we aimed to check how many of the unseen 339 puzzles can be automatically solved. Second, we aimed to identify the impediments for those puzzles that couldn't be solved. Hence, we analysed three points of failure: i) the incapacity of the grammar to parse the text, ii) the failure to identify all the persons from the puzzles, and iii) the failure of coreference resolution step. Table I bears out the experimetal results against these three coordinates. In line 1, since 43 puzzles were used to build the grammar, just the rest of 339 puzzles are tested. The performance of the Named Entity Recognition (line 2) and Coreference Resolution (line 3) were tested against the entire set of 382 puzzles. The conclusions for each metric are: 1) Grammar: The grammar manually built by analysing 43 puzzles manages to parse 97.64% of the remaining 331 puzzles. The 8 unsolved puzzles need more grammar rules to be covered 2) Named Entity Recognition: The implementation offered by spaCy encountered some problems in finding out all of the person names from our puzzles. For instance, there were some puzzles where a name like "Peggy" or "Bozo" were not recognized. In some puzzles, although all the person names were found, the trained pipeline used made some other mistakes (e.g. it identified "Ted and Bob" as a single person instead to "Ted" and "Bob" as different persons). 3) Coreference Resolution: Two problems were noticed: i) there were some pronouns which could not be bound to any person name; and ii) the pronoun was not replaced with the name of the person it should. Both cases led to the incapacity of the system to solve the puzzle further. However, the task of coreference resolution had a performance score of 92.15%. We also analysed how the performance is affected by the puzzle's complexity. Here, we measure complexity in terms of number of persons appearing within the text (see Table II).
We focused here on knight and knaves puzzles. However, the system is extensible: to solve puzzles from a different domain, one has to provide the corresponding grammar file (see Figure 8). The public version of our system provides small grammars for other types of puzzles.
Taking into account that there were five puzzles where neither the Named Entity Recognition, nor the Coreference Resolution managed to be applied successfully, in total, a number of 73 puzzles out of 382 could not be solved. Hence, on the proposed set of puzzles, the overall performance of our solver is 80.89%.

IV. DISCUSSION AND RELATED WORK
Solving logical word puzzles is considered a challenging task. Lev et al. have also proposed a solution based on grammar rules, FOL, and model builders [10]. Lev et al. have focused multiple-choice puzzles, so the inferences only have to find out the correct answer, not to discover it. Milicevic et al. have tackled the task by using the ink Grammar general-purpose English parser, a semantic translator, and an automated logical analyzer [11]. The Alloy language is used as a formal representation of the puzzle and and its corresponding constraints solver computes the solution. The solver is designed around the Zebra puzzles and tested on a dataset of 68 puzzles. Here, the user must rephrase the ambiguous phrases, which is a disadvantage of a general parser. Our architecture is similar to the work of Milicevic as both solutions compose a parser and an inference module. Our parser is based in NLTK and Spacy while the inference modules uses MACE4 to find the solution and Prover9 to graphically represent the proof for the solution.
Bogaerts et al. have proposed a solver for logic grid puzzles which also makes use of QA and XAI [12]. De Cat et al. employs an extension of FOL [13]. A drawback that the named entities (e.g. persons, colors) in the puzzle cannot be detected automatically and must be stated by the user. Also, there exists a semi-automated process to detect the synonymy between verbs. Differently, we empower our agent with capabilities to automatically detect synonymy between other part-of-speech too, such as nouns.
Jabrayilzade and Tekir have proposed the DistilBERT tool that automatically solves logic grid puzzles [14]. The clues are translated in Prolog and the reported accuracy is 100%. The zebra puzzles have different categories that need to be recognised within the text (e.g. person, name, occupation, color). One assumption of Jabrayilzade and Tekir is that these categories and also their instances are clearly given before parsing the text. Differently, we relaxed this assumption by performing named entity recognition. This task introduces some points of failure (89.52% in our experiments), but it represents a mandatory step towards automatic generic solvers. A second assumption of Jabrayilzade and Tekir is that the domain is closed to five predicates only: is, either, all different, pair different, and comparison. The solver is based on classifying the clues into one of these five predefined predicates. This is performed with a feed-forward neural network with Softmax activation on top. A number of 50 puzzles were used for training and 100 for testing. In our case, we analysed 43 puzzles to identify the recurrent predicates, and we tested the resulted grammar on 331 puzzles.
Mitra and Baral have developed the Logicia system [15] also for 150 Zebra puzzles. The clues are classified using a maximum entropy model based on features like POS tags or dependency trees. The target language is answer set programming, based on which 71 out of 100 puzzles have been solved.
Some work has been made on the particular puzzles of "knights and knaves". For instance, Chesani et al. have proposed the following workflow: i) understanding the text, ii) identifying modeling (e.g. proposition logic) and solving techniques (e.g. truth tables, resolution), iii) identifying problem components and hidden knowledge (if exists), iv) framing the model and solving the problem [16]. A completely different approach, via Logic Algebra, is the work of Ciraulo and Maschio [17]. This method relies on a system of equation for solving a puzzle. Thus, encoding every inhabitant from puzzle with a different unknown variable, assuming that a truth proposition is equal to 1, using the properties of a boolean ring and a binary encoding for knight and knave, the solution is found by solving the equations. The disadvantage of this proposal is that it cannot solve other types of logical word puzzles, being focused just on the types and variations of puzzles with knights and knaves.
Our system is fairly successful on the benchmarks of 382 problems, but these benchmarks are limited to a single category of puzzles. In particular, "knights and knaves" domain require very little background knowledge: the main axioms are common to all problems and the only additional knowledge used is the synonymy of some words. We are interested to apply the method to other domains, by automatically import background knowledge.
Our approach belongs to the larger domains of Question Answering (QA) and Explainable AI (XAI). QA highlights the ability of a system to answer the questions addressed by humans in natural language, while XAI explains how the solution was found in a human understandable way. Regarding QA, our software agent is able to provide Yes/No answers to natural language questions related to each puzzle. Moreover, in line with XAI, the agent can back its answer, providing a graphical representation of the proof.

V. CONCLUSION
We described here a tool to automatically solve logical puzzles, in particular knights and knaves puzzles. The puzzles are given in natural language. The problem is parsed and translated to first-order logic using the Natural Language Toolkit with a hand-crafted lexicon and grammar. The MACE4 model finder constructs a solution. In addition, the system allows to process natural language yes/no questions by translating them to first-order logic and letting the theorem prover Prover9 find the answer. By combining natural language processing with theorem proving, the system can fully explain its answer in the form of a graphical proof. The evaluation experiments shown that 309 out of 382 problems could be solved, with only 43 of them were used to build the grammar, and the rest were completely new to the system.
Our solution is based on manually created grammar rules for a closed domain: knights and knaves puzzles. The lexicon benefits from the Wordnet lexical database, while the natural language processing pipeline, including coreference resolution, was developed with the Spacy library. The resulting FOL theory is given to MACE4 model finder. Since MACE4 works on finite domain, it is important to compute the domain size of each problem. This is in our case, the exact number of persons that need to be instantiated as knights or knaves. Hence, the named entity recognition was a necessary task to automatically compute the domain size. We also empower our software agent with the capability to provide Yes/No answers to natural language questions related to each puzzle. Moreover, in line with XAI, the agent can back its answer, providing a graphical representation of the proof. These features together with the overall performance rate of 80.89% make the proposed solution an improvement upon similar solvers for natural language understanding in the puzzles domain.


Quantum Chaotic Butterfly Optimization Algorithm With Ranking Strategy for Constrained Optimization Problems

Nature-inspired metaheuristic optimization algorithms, e.g., the butterfly optimization algorithm (BOA), have become increasingly popular. The BOA, which adapts the food foraging and social behaviors of butterflies, involves randomly defined, algorithmic-dependent parameters that affect the exploration and exploitation strategies, which negatively influences the overall performance of the algorithm. To address this issue and improve performance, this paper proposes a modified BOA, i.e., the quantum chaos BOA (QCBOA), that relies on chaos theory and quantum computing techniques. Chaos mapping of unpredictable and divergent behavior helps tune critical parameters, and the quantum wave concept helps the representative butterflies in the algorithm explore the search space more effectively. The proposed QCBOA also implements a ranking strategy to maintain balance between the exploration and exploitation phases, which is lacking in conventional BOAs. To evaluate reliability and efficiency, the proposed QCBOA is tested against a well-utilized set of 20 benchmark functions and travelling salesman problem which belongs to the class of combinatorial optimization problems. Besides, the proposed method is also adopted to photovoltaic system parameter extraction to demonstrate its application to real-word problems. An extensive comparative study was also conducted to compare the performance of QCBOA with that of the conventional BOAs, fine-tuned particle swarm optimization (PSO) algorithm, differential evolution (DE), and genetic algorithm (GA). The results demonstrate that, chaos functions with the quantum wave concept yield better performance for most tested cases and comparative results in the rest of the cases. The speed of convergence also increased compared to the conventional BOAs. The proposed QCBOA is expected to provide better results in other real-word optimization problems and benchmark functions.

I. INTRODUCTION
Optimization is a procedure of determining the best solution for a specific problem under a set of given conditions. Solutions are categorized as worthy or unworthy after determining a fitness function that defines the relationship between system bounds and constraints. The fitness function is commonly expressed based on its application. Till now, several procedures have been adopted to deal with optimization problems using traditional methods that are based on exact mathematical solution method and population based stochastic methods [1].
Natural surroundings have been the chief motivation for the mainstream utilization of the swarm-based optimization methods and are becoming increasingly dominant and widely acceptable for solving complex real-world optimization problems [2]- [4]. These meta-heuristic methods randomly execute the optimization process which typically begins by generating a population of random solutions. These early solutions are manipulated and updated through various exploration and exploitation strategies over predefined iterations. The exploration and exploitation strategies are derived by imitating some biological behavior, physical phenomena, or biological evolution. Some examples of swarm intelligence algorithms are particle swarm optimization (PSO), artificial bee colony (ABC) and firefly algorithm. Many researchers considered naturally occurring phenomena to develop optimization algorithms. Some illustrations are lightning search algorithm (LSA), simulated annealing (SA), harmony search algorithms (HAS), and gravitational search algorithm (GSA) [5]- [8]. Genetic algorithm (GA), differential evolution (DE), and evolutionary programming (EP) are examples of evolutionary algorithm and are inspired by biological process: reproduction, mutation, recombination and selection [9], [10]. The primary focus of these methods is to solve the diversity of problems in a more accurate, faster, and robust manner.
Regardless of the qualities of the conventional metaheuristic algorithms found in the literature, as per the no-free lunch theorem (NFLT) [7], [8], there is not a single population-based algorithm that can guarantee solving all optimization problems effectively and accurately.
The NFLT theorem motivates and permits the investigators to expand the present methods or suggest new procedures for better optimization. In this study, our primary goal is to develop a BOA variant to enhance the performance of the original BOA. The BOA has many limitations, primarily relative to the use of many constant parameters and the way exploitation and exploration are performed. The proposed method is motivated by the observation that quantum computing enables an algorithm to explore a search space efficiently [9]- [11]. In addition, it has been proven that replacing random values with a suitable chaotic function can provide fast convergence and accurate results [8]- [15]. Therefore, we introduce a chaos function, quantum computing technique, and a ranking strategy to improve the accuracy and performance of the BOA.
The key contributions of the proposed study are as follows: 1. A new exploration strategy based on the quantum wave concept is proposed to avoid the limitation of original global search strategy of BOA.
2. Dynamics in the algorithm-dependent constants and smooth time-varying parameters are introduced by incorporating chaos maps to prevent entrapment in local minima. 3. A strategy to maintain a balance between the exploration and exploitation phases using a ranking-based nonlinear timevarying functions is proposed.
An extensive investigation was performed using different performance indicators to compare the performance of the proposed algorithm with that of the conventional BOAs. We found that the proposed algorithm obtained the exact optima for 11 test functions and demonstrated improved results for 15 of the 20 commonly used benchmark functions. Moreover, when the proposed algorithm was used to solve photovoltaic system parameter extraction and the travelling salesman problem, the proposed algorithm outperformed the traditional BOAs. In addition, the convergence speed increased compared with that of the conventional BOA. Thus, we expect that the proposed algorithm will provide better results in various real-world problems and other benchmark functions.
The remainder of this paper is organized as follows. Section II reviews the related and relevant works. In Section III, we introduce the original BOA and highlight its primary weaknesses. Section IV presents the proposed quantum chaotic BOA in detail, and Section V discusses our validation and testing method. In Section VI, we report simulation results and discuss our findings. Finally, conclusions are presented in Section VII.

II. RELATED WORKS
The social behavior of various organisms has been investigated to develop metaheuristic nature-inspired optimization algorithms. Living organisms rely on various immediate and generational survival mechanisms, such as food foraging and hunting, anti-predator defense mechanisms, and selecting an appropriate mate [2]- [5]. These survival mechanisms and the ability to adapt to competitive environments have inspired the development of metaheuristic optimization algorithms. Generally, metaheuristic optimization algorithms are classified as swarm intelligence, evolutionary, and natural phenomenon-based algorithms. Various swarm intelligence algorithms have been proposed, such as particle swarm optimization (PSO), artificial bee colony, and firefly algorithms [2], [3], [16]. Optimization algorithms, such as lightning search, simulated annealing, harmony search, and gravitational search algorithms, have been based on naturally occurring phenomena [6], [17]- [19]. Algorithms inspired by biological evolution, reproduction, mutation, recombination, and selection include genetic, differential evolution, and evolutionary programming algorithms [20], [21].
Nature-inspired algorithms, such as the krill herd optimization (KHO) algorithm, involve two phases, i.e., the intensification (exploitation) phase and the diversification (exploration) phase. The exploitation phase focuses on a reduced search space identified during the exploration phase, which explores the entire search space by random movement. The exploration phase ensures avoidance of premature convergence with local optima [3], [22]. The KHO algorithm is based on the herding behavior of krill, i.e., increasing population density, as well as their food foraging characteristics [22]. However, a previous study determined that the KHO algorithm fails to maintain a proper balance between the exploration and exploitation phases. Thus, Saremi et al. [8] attempted to improve the KHO algorithm by including a chaotic function in that study, to explore the entire optimization space fully to avoid falling into local minima. All random variables in the algorithm were replaced by a chaos function. To further enhance the KHO, Wang et al. [23] proposed a hybrid quantum PSO method. The authors reported that, by incorporating the quantum method, the exploration scheme of the krill in search space could be increased.
The salp swarm algorithm (SSA) [24], another metaheuristic optimization algorithm, is also inspired by a natural phenomenon. Salps form a long chain with a leader, who searches for food, and followers, who depend on the leader to locate a food source. In the SSA, the leader explores the search space by moving independently around its neighborhood and the followers move with respect to each other. Thus, the original SSA lacks communication between salps and this affect the convergence speed. Therefore, the chaotic SSA (CSSA) was proposed to resolve the convergence issue [25]. In the CSSA random variables are replaced by chaotic variables. To address the limitations of the SSA, including trapping in local and deceptive optima, the quantum evolutionary SSA (QSSA) was developed [26]. Besides quantum behavior, an elite opposition-based learning strategy was employed to increase the diversity of the search mechanism.
Jain et al. [27] proposed the squirrel search algorithm (SQSA). The SQSA is based on the gliding motion squirrels use when moving between trees, which is subject to modified forms of lift and drag forces. In addition, the SQSA also considers squirrel food foraging and storing behaviors. However, the original SQSA demonstrated some limitations. Exploration capacity and avoidance of local entrapment were improved by incorporating a seasonal change factor; thus, the direction of squirrel movement was changed. Here, the random movement (exploration) is defined by predator presence probability, and this value was replaced by an adaptive value that replaced the constant value by a dynamic equation that varied with the iteration number to maintain balance between exploration and exploitation phases [28].
Mirjalili et al. introduced the multiverse concept to develop a nature-inspired optimization method. The developed multiverse optimization (MVO) algorithm is based on multiple ''big bangs'' where each big bang caused the birth of a universe [29]. However, the exploration of the search space is not balanced and efficient in the MVO algorithm. Ewees and Elaziz [30] proposed a modified MVO algorithm that integrated the chaos theory and the HHO algorithm. Chaos variables are used to define the important parameters in the basic MVO algorithm, and the HHO algorithm is used to perform a local search to exploit the search space more effectively. The simulation results indicate that the hybrid composition yields better results compared to the results obtained by the MVO and HHO algorithms separately.
Recently, Arora and Singh [5] proposed the butterfly optimization algorithm (BOA), which was inspired by the food foraging behavior of butterflies. Butterflies, like humans, have five senses, and their sense of smell is considered the most important relative to locating food sources and mates. Each butterfly generates a fragrance that can be sensed by other butterflies. A portion of the butterfly population senses the best fragrance (fitness) and moves toward it. This process is referred to as exploitation. Others in the population that cannot sense the fragrance move randomly, i.e., these individuals perform an exploration process. In the original BOA algorithm, several parameters are improperly tuned, which results in slow convergence and local entrapment. These parameters include sensory modality and a power exponent. In addition, the global and local search is not effectively controlled due to the use of a simple probability switch [31]. Thus, two other studies introduced limited improvement by including an additional search phase [32] and chaotic maps [31]. The chaotic maps improve the global search slightly; however, adding the extra search step increases the computation time of the algorithm.
From the aforementioned literature review, we found that nature-inspired optimization algorithms are simple and effective to solve multi-objective, multi-dimensional interdisciplinary optimization problems. However, such algorithms tend to suffer from slow convergence, local entrapment, imbalance between the exploration and exploitation phases, parameter tuning, and a lack of communication among particles/individuals. Therefore, new methods are required to address the limitations of each optimization method. We found that many studies have applied hybridization, chaotic maps, reverse learning mechanisms, wavelet mutation, and quantum theory concepts to improve various recent optimization methods [9], [23], [30], [33]- [35].
Herein, our primary goal is to develop a BOA variant to enhance the performance of the original BOA. As previously discussed, the BOA has many limitations, primarily relative to the use of many constant parameters and the way expiration and exploration are performed.

III. CONCEPT OF BUTTERFLY OPTIMIZATION ALGORITHM
The BOA is a population-based nature-inspired optimization method developed based on the social and food foraging behaviors of a butterfly swarm [5]. In the BOA, the butterfly population is generated and permitted to initially move randomly in the search space. The stimulus intensity is calculated by the objective function to be optimized. Here, it is assumed that each butterfly in the search space generates a fragrance VOLUME 9, 2021 and can sense the fragrance of other butterflies. Some butterflies can sense the fragrance from the best butterfly and move toward it via a global search mechanism. Butterflies who fail to sense the fragrance move randomly in the search space, i.e., local search. Thus, in each iteration, the position of each butterfly is updated based on the magnitude of the fragrance according to the global and local search equations.
Here, fragrance (f) generated by a butterfly is expressed as follows: where c is the sensory modality, I is the stimulus intensity estimated from the objective function to optimize by inputting the butterfly's location, and a is the power exponent value. Note that these parameters play a significant role in the variation of the degree of absorption of fragrance. Parameter a is an important parameter that takes values in the range zero to one, where 1 means that a neighboring butterfly can sense the full fragrance. This is the case in an ideal idealized environment, i.e., there is no absorption of fragrance by the surrounding space. In contrast, if a is zero, the fragrance generated by a single butterfly cannot be sensed by any other butterfly. Therefore, the power exponent value can control the behavior of the BOA. The sensory modality value is also important, and these two parameters have a critical effect on the algorithm's convergence speed. In the BOA, the sensory modality value is varied in iteration number (t) as follows: where T is the total number of iterations. After defining the necessary variables, the initial positions of the butterflies are assigned randomly. Then, the fitness value and fragrance magnitude are calculated and stored at each position. The global search, in which butterflies move toward the best butterfly, is expressed as follows: where g * is the global best among all solutions in the current iteration, and r is a random number in the range of zero to one to create a certain degree of randomness in the search horizon. Some individuals in the population of butterflies fails to detect the fragrance; however, they are permitted to explore the entire search space via random movement. The local search is expressed as follows: where x t j and x t k represent the positions of any two butterflies belonging to the same swarm, and r is a random number in the range of zero to one.
After the global and local search is modeled, the decision to select a global search or an intensive local search is determined using probability switch (p). The probability switch value is a constant value between zero and one. Then, a random number is generated for each butterfly in each iteration to compare with the probability gate value to determine the type of search to be conducted. Thus, random selection between exploration and exploitation with a fixed probability switch value may lead to local optimal solution. Figure1 shows the pseudocode of the original BOA. Generally, inappropriate handling of the following parameters can lead to poor performance with the BOA.
• Sensory modality value: A high initial value and increasing this variable can lead to premature convergence or large movement of butterflies while updating.
• Power exponent value: Fixing this value (as in the original BOA) may not help escape a local minimum. A smaller value results in less communication between butterflies and setting it to larger value may cause a butterfly to move toward a single butterfly.
• Probability switch: Fixing this value (as in the original BOA) and determining the type of search to be performed based on a random number may lead to an imbalance between exploration and exploitation.
• Local search: Based on (4), local search performs completely a random work by selecting any two butterflies from the same swarm without an appropriate strategy. Therefore, to address these issues, we proposed a quantum chaotic BOA (QCBOA).

IV. PROPOSED QUANTUM CHAOS BOA
In this section, we describe the proposed QCBOA. To address the limitations of the original of BOA, three different tactics are used in the QCBOA. First, chaotic functions are adopted in the sensory modality and power exponent values rather than constant values to incorporate randomness and dynamical properties for accelerating the optimization algorithm convergence and preventing premature convergence to local minima. Second, a new local search concept is introduced with the help of quantum wave theory to enhance the efficiency and convergence speed of BOA by enabling the particles to seek the search domain precisely. Finally, the method to select local or global search is modified by applying a rank selection criterion. Prior to discussing how the proposed techniques are applied in the appropriate stages of the BOA, the chaotic maps, quantum wave mechanism, and rank selection criterion are discussed in the following subsections.

A. CHAOS MAPS
Chaos theory is a branch of mathematics that deals with nonlinear dynamical systems. Nonlinear means that it is inconceivable to predict the system's response by combining the inputs, and dynamical means changes in the system from one state to another over time. A chaos function represents a dynamic system with a deterministic equation. However, depending on the initial conditions, a chaotic function can produce wildly unpredictable and divergent characteristic behaviors [38]. Thus, a chaos function will increase the intensification and diversification of the optimization algorithm, which can prevent local optimum solutions and move toward a global optimum. These functions follow very simple rules and have very few interacting parts; however, in each iteration, the generated value is dependent on the previous value and initial conditions.
In this study, we implement three different chaotic maps namely logistic mapping, iterative mapping, and tent mapping with the sensory modality (c) and power exponent (p) calculations in the BOA. These chaos functions are found to exhibit superior performance compared to other chaos functions described in [31].
Logistic map: Here, x t represents the value in any iteration t, and r represents growth rate, which can take values from 3.0 to 4.0.
Iterative map: In the iterative map, the value of P can be selected between 0 and 1, and the output x t is a chaotic variable that takes a value from 0 to 1.
Tent map: The tent map is a one-dimensional map that comparable to a logistic map. Here, the output x t is a chaotic variable that takes a value from 0 to 1.
In the proposed QCBOA, the sensory modality value is modified by adding disturbance to the c value in the original BOA using a chaos function. We modify the sensory modality value as follows: where c_mod(t) is the modified sensory modality value in any iteration t. To implement the logistic, iterative and tent chaos maps, (5), (6), and (7) can be used to replace x t in (8), respectively. Similarly, the constant value of the power exponent over all iterations in the original BOA is replaced as follows: The differences in the sensory modality and power exponent between the original BOA and proposed QCBOA with the logistic map are shown in Fig. 2. As can be seen, the c_mod and a_mod values do not vary linearly, and these values are not constant over all iterations.
As indicated in Fig. 2, the transition of the sensorymodality value (indicated by the red lines in the BOA) can lead to premature convergence. Moreover, the adoption of a constant value for the power exponent can produce a locally minimal output. The intensification and diversification of the searching technique can be intensified and diversified by adding a chaotic disturbance and thus easing the movement toward a global solution. Automatic tuning of critical parameters is possible through chaos mapping of unpredictable and divergent behavior.

B. QUANTUM WAVE CONCEPT
The quantum computing theory boosts the solutions of several real-world problems in soft computation techniques. One of its main application is improving optimization algorithms to explore the search space more efficiently and effectively [12], [28]. In this approach, all particles are assumed to move under quantum mechanical rules rather than classical Newtonian random movement. In the quantum wave concept, a particle is assumed to move in a one-dimensional well δ, and the position of particle X can be calculated as follows.
In (10), p t i,j is the local attractor point (also called the particle motion center) at time t [37]. Convergence to an optimum solution can be achieved quickly if each particle moves toward its local attractor. The local attractor point can be defined as the random average of the global and local best particles in the swarm as follows.
Here, φ is a random number with a uniform distribution function over the interval between zero and one, P t i,j is the local best, and G t j is the global best among all particles. In addition, u is a random number in the range of zero to one, and L t i,j is the characteristic length of potential well δ at time t, and this value is directly related to the convergence speed and search ability of the algorithm. L t i,j is expressed as follows.
Here, C t is the mean best position, i.e., the mean of the best positions of all particles participating in quantum computing.
Here, M is population size, and P t i is the personal best position of particle i. In addition, α is a tunable parameter (i.e., the contraction-expansion (CE) coefficient) to control the convergence speed of the algorithm. The CE coefficient is sensitive to population size and the number of iterations and can be fixed to a constant value or varied in a given limit. Note that parameter α should be reduced during the progression of iterations as follows.
Here, α 1 and α 0 are the final and initial values of α, respectively, T is the total number of iterations, and t is the current iteration number.

C. RANKING AND SEARCH TYPE DECISION
Ranking is the relationship among two mathematical values, where each value can be less than, greater than, or equal to the second value. In this case, decreasing order sorting is employed to rank butterflies based on the fitness value. Here, ranking is employed to facilitate fair decision-making about the number of butterflies performing exploration and exploitation based on nonlinear time-varying coefficients.
Butterflies with higher rank perform exploitation, and the rest perform exploration. The exploration and exploitation factors change according to the following expressions: where 90 and 5 are the initial and final percentage values of the exploration coefficient, respectively. In the nonlinear time-varying strategy, the exploration coefficient C explore is reduced nonlinearly during the course of the run; however, the exploitation coefficient C exploit is nonlinear and is increased inversely until the maximum iteration T is reached, as shown in Fig. 3. As can be seen, this method provides a greater value for the exploration component and a smaller value for the exploitation component at the beginning of the optimization procedure, which allows the search elements to move around the search space rather than moving toward the best individual in the population. Later in the optimization process, this provides a smaller cognitive component and larger social component, which allows search elements to converge to the global optimum.

D. BOA MODIFICATIONS
The techniques described in Sections A-C were implemented in the proposed QCBOA to improve the performance of the original BOA. Table 1 describes the suggested modifications performance enhancement, and Fig. 4 shows the pseudocode of the proposed QCBOA and how the modifications are implemented in various stages of the algorithm (indicated by the blue color).

V. VALIDATION AND TESTING A. BENCHMARKS AND SETUP
We validated the proposed algorithm by testing it on a set of 20 benchmark functions and the travelling salesman problem (TSP) [6], [38] commonly used to test new optimization methods. These functions can be classified based on several criteria, e.g., linearity or nonlinearity, continuous or non-continuous, and convex or non-convex. However, functional characteristics, e.g., unimodal, or multimodal, separable, or non-separable, and dimensionality, are important for benchmark functions to test the efficacy of an optimization method. If a function increases and decreases monotonically, then the function is considered to be unimodal. Multimodal functions present two or more vague peaks in the function's surface. Separable functions are easier to solve and optimize compared to non-separable functions. In addition, optimization complexity also increases with dimensionality. Therefore, in this study, unimodal, multimodal, separable, non-separable, and multi-dimensional functions were considered in different combinations [5] to evaluate the proposed QCBOA.

1) UNIMODAL FUNCTIONS
The unimodal functions employed to validate the proposed QCBOA are listed in Table 2, where the columns show the dimensionality n, search space domain, and optimal value for 12 benchmark functions F1-F12. Here, sphere function F1, step function F2, and quartic function F3 are separable, and functions F4-F12 are unimodal non-separable functions. As the complexity expand with increase in dimension, the dimensions of different benchmark functions are varied up to a maximum value of 100.

2) MULTIMODAL FUNCTIONS
Functions F13-F20 are multimodal functions. Among these functions, the Rastrigin (F13) and Branin (F14) functions are separable, and functions F15-F20 are multimodal non-separable functions. Functions F13-F20 are detailed in Table 3 with dimension n, search space area, and optimal value.

3) TRAVELLING SALESMAN PROBLEM (TSP)
TSP is among the most intensely studied mixed-integer programming problems and here the capability of the proposed QCBOA is tested to solve this problem [6]. In TSP, given a list of cities and the distance between each pair of them, the objective is to estimate the shortest distance required to visit each city exactly once starting from and ending at a particular city. This problem is used as a benchmark to test the performance of state of art optimization solvers. The order in which cities are visited is known as a tour. Table 4 provides the details of the TSP.

4) PHOTOVOLTAIC SYSTEM PARAMETER OPTIMIZATION PROBLEM
As the world is moving towards renewable energy sources, the photovoltaic (PV) systems are getting great deal of attention. The output from a PV system varies depending on several factors and some of these include temperature, irradiance, wind speed and wind direction [39], [40]. The parameter extraction is a tedious job as the system is highly non-linear. In this work, the parameters of 255Wp TRINA SOLAR VOLUME 9, 2021 TSM-255 PAO5.18 photovoltaic module is required to be extracted.
Equivalent single diode solar cell model (SDM) shown in Fig. 5 is the commonly used electric circuit models to predict the performance of a PV system and to model the system [41]. The modelling includes several loss components and leakage currents which are key factors to design exact system [42], [43]. R s is the lumper series resistance of the whole system including the PN junction diode. This includes the electrode resistance, current flowing resistance and the resistance between the diode semi-conductor and the electrodes. The leakage current factor of the PN junction diode is modelled as R p . From the model, applying Kirchhoff's current law and non-ideal diode theory the terminal current output is the vector sum of photo generated current I pv , the diode current I D and the current through the shunt resistance I P .
The diode current can be expressed using Shockley equation. I sd is the diode diffusion and the saturation currents, q is the electron's charge V is the terminal voltage, n is the diode's ideality factor, K is Boltzmann's constant and T is the temperature of the solar cell in Kelvin. The expression for shunt current I p .
Substituting (18) and (19) in (17)  From the expression for system output current (20), it is evident that there are five unknown parameters and hence the vector to be optimized is [I pv , I sd , R s , n, R p ]. An objective function is formulated by considering all the unknown parameters and since these parameters change with temperature and irradiance, they are usually optimized by numerical methods, curve fitting techniques, and optimization methods.
Experimental I-V curve values from the experimental data are used to extract the five unknown parameters. The objective function is defined by the following equation.
From (20), we can express the function of current as: The derivative with respect to I of the above expression f I (I ) can be written as:   The I-V curve can be obtained by Newton-Raphson (NR) method.
Here, k is the iteration number. The current is calculated at various points of an I-V curve until the stopping error ε s is less than a predefined value of 1 × 10.3 [44]. The error is used as a criterion to quantify the difference between the experimental current (I exp ) and the Here, M is the number of the data points.
All the five unknown parameters as represented by the vector to be optimized should be within their limits. Constraint boundaries are given in Table 5.
R p_low ≤ R p ≤R p_up (29) n low ≤ n ≤ n up (30) The experimental setup shown in Fig. 6 was used extract experimental data and obtain the IV curve for the TRINA SOLAR TSM-255 PAO5.18 photovoltaic module. The specification of the above system is mentioned in Table 6. In this study, the module was connected to 3kW FuelCon electronic load to generate the I-V curve (see Fig. 6).
To compare the effectiveness and robustness of the proposed QCBOA, the obtained results were compared with those obtained using the original BOA algorithm with the time-varying sensory modality and constant power exponent values [5]. Here, the probability switch value was used for butterflies to switch between the exploration and exploitation phases. A further comparison was performed using the chaos BOA (CBOA) as proposed by Arora and Singh [31], where the initial butterfly population is generated using the chaos function. In addition, the random probability index value is generated for each iteration using chaos maps. Here, iterative and tent mapping were considered because they provide better performance in the BOA with chaos. The parameters and initial population generation method for the proposed QCBOA, original BOA, and chaos BOA are listed in Table 7. The butterfly population size and maximum iterations for all optimizers were set to 50 and 500, respectively.
The independent runs for each algorithm were set as 50. Furthermore, the statistical results were compared with that of fine-tuned PSO, DE, and GA provided with the population size is 50, maximum iteration 500, 25000 fitness evaluations, and number of independent runs is 50. All the algorithms were implemented in MATLAB (R2020a).

B. EVALUATION METRICS
Different performance indicators (PI) were used to evaluate the performance of the algorithms based on independent runs of each algorithm using the parameter settings already specified.

1) PARAMETRIC TESTS
The following parametric tests were used for performance assessment of the proposed QCBOA.
The bias is calculated as the average error.
Here, n is the number of independent runs of each algorithm (50 in this case). Note that a smaller bias value indicates good performance.
The mean square error (MSE) can also be used to evaluate error.
Note that the MSE does not reflect the original error because the error is squared (32). To avoid the scaling problem associated with MSE, the root MSE (RMSE) is suggested because it does not treat each error in the same manner. This VOLUME 9, 2021  implies that a single bad value may result in a higher RMSE value. RMSE is defined as follows.
The other PIs included the best, worst, median, average, and standard deviation (SD) values obtained from the 50 independent runs for the benchmark functions.

2) NON-PARAMETRIC TESTS
Non-parametric tests are statistical analysis methods for sample data that do not obey a specific distribution (i.e., non-normal variables). Here the results are validated for different test functions using Wilcoxon rank-sum test, which is the non-parametric version of independent samples t-test [45]. Rather than examining the actual values to compare the different algorithms using the Wilcoxon rank sum test, the actual values are not examined. Instead, the rankings of the samples are allotted by combining two populations. Here test functions considered are minimizing functions; therefore, the total observations in the two population are sorted in ascending order. Then, the Wilcoxon rank-sum statistics are evaluated by summing all these ranks: Here, w A is the sum of the ranks in population A. In a Wilcoxon rank sum test the null hypothesis and the alternate hypothesis for comparison of both algorithms can be written respectively as follows: H 0 : Population A >= Population B; Ha: Population A < Population B.
Then, the p value can be defined as: Here, W A is the distribution of the rank sum. The calculated p value is compared to a threshold α, known as the significance level which is 0.05.

VI. RESULTS AND DISCUSSION
Here, we present and discuss the obtained results.

A. RESULTS OF UNIMODAL TEST FUNCTIONS
The bias, RMSE, best, worst, median, average, SD, and execution time (ET) values for the unimodal benchmark functions are shown in Table 8 (best values are shown in bold). As can be seen, for tested unimodal functions F2, F4, F6, F9, F10, F11, and F12, the proposed QCBOA obtained the exact optima value for all 50 runs; thus, the SD is zero. This is also clear from the box plot shown in Figure 7. In the generated box plot (Figure 7) and tabulated results (Table 8), the proposed QCBOA adopts logistic chaos function to obtain the results and for chaos BOA, tent mapping is used for comparison as these chaos maps provide better and consistent results during the analysis. For these functions, zero error was obtained by the proposed QCBOA, the bias and RMSE values are also zero (Table 8).
For test functions F1, F3, F7, and F8, the proposed QCBOA with the logistic chaos function obtained near optimal solutions and outperformed the other versions of BOA. For test function F8, QCBOA with logistic chaos mapping obtained higher accuracy than the original BOA. However, here the exact result is given via DE and GA algorithms. For test function F5, QCBOA did not outperform the original BOA; however, it did outperform BOA with chaos. Here, QCBOA produces higher RMSE value; this is mainly due to the presence of one or two outliers in the 50 independent runs that were distant from the exact solution, as shown in Fig. 7. Figure 8 compares the convergence characteristic curves for different optimization algorithms. For the proposed QCBOA, only the logistic chaos function was considered. In addition, for BOA with the chaos function, tent mapping was considered because it yields better performance. As can be seen in Fig. 8, for a majority of the unimodal benchmark functions, the proposed QCBOA exhibits good convergence characteristics. Therefore, from the analysis with unimodal test functions, we conclude that the proposed QCBOA performs better and provides consistent and more accurate results for most of the unimodal test functions.

B. RESULTS OF MULTIMODAL TEST FUNCTIONS
For the multimodal functions, the bias, RMSE, best, worst, median, average, SD and ET values are given in Table 9, where the best results are shown in bold. For test functions F13 and F16 the proposed QCBOA obtained the exact solution; thus, the SD and PIs are zero, which is illustrated by the boxplots in Fig. 9. The proposed QCBOA also provided near optimal solutions for test functions F15 and F19. For test function F14, the original BOA outperformed the proposed QCBOA by a small margin; however, the proposed QCBOA outperformed the chaos BOA algorithm. The proposed QCBOA failed to obtain the best solution for test functions F17, F18, and F20; however, the PIs are acceptable for test functions F18, and F20 because those values are in an acceptable range, as shown in Table 9 and Fig. 9. However, the proposed QCBOA failed to obtain a good solution for test function F17 compared to the original BOA.
Here, the SD and PI values were high compared to the output obtained by compared algorithms. Figure 10 compares the convergence characteristic curves for the multimodal functions. Here, for the proposed QCBOA, only the logistic chaos function was considered. In addition, for BOA with the chaos function, tent mapping was considered because it yields better performance. As shown in Figure 8, for most multimodal benchmark functions, the proposed QCBOA demonstrates faster convergence. For functions F13, F15, F16, F17, F18, and F19, the proposed QCBOA provided faster convergence compared to the original BOA and chaos BOA. Therefore, we conclude that the proposed QCBOA performs better and provides consistent and more accurate results for most multimodal test functions.

C. RESULT OF TSP
Like the previous tests, TSP benchmark function is also evaluated again for 50 times with all the tested algorithms. The results considering the best, worst, average, median, and standard deviation of the objective function obtained by QCBOA, BOA, CBOA, PSO, DE, and GA are shown in Table 10. The QCBOA again finds the best minimum distance tour for TSP  than normal BOA and chaos BOA. Moreover, in terms of consistency, QCBOA performance is acceptable because it has lower average value compared to BOA and CBOA. This can also be clearly seen in the boxplot shown in Fig. 11. From the Fig. 11, it is clear that, the convergence conduct of DE and GA is better than QCBOA. Nevertheless, the Nevertheless, the performances of BOA and chaos BOA are improved by the proposed modifications.

D. RESULT OF PV SYSTEM PARAMETER EXTRACTION
The results obtained for photovoltaic system parameter extraction is exhibited in Table 11. The best values are bold faced. From the statistical analysis, it is clear that the proposed QCBOA performs better compared to BOA and BOA with chaos. The convergence characteristics and the box plot are also plotted as shown in Fig. 12. The convergence characteristics also exhibit better performance. From the box plot, it is evident that all the generated values are more acceptable compared to other two conventional BOA algorithms.

E. NONPARAMETRIC TEST RESULTS
Wilcoxon rank-sum test is conducted independently to compare the proposed QCBOA with the other tested algorithms. All algorithms are run for 50 independent trials and thus the ranking varies from 1 to 100 for each sample in the combination of two algorithms. Therefore, the possible sum of ranking falls in the range 1275 ≤ w A ≤ 3775.
The minimum possible sum of ranks occurs for the algorithm that completely outperforms the others in all 50 runs and the maximum possible sum of ranks is observed for the algorithm that underperforms in all 50 runs. The sums of the ranks of QCBOA and the p values of Wilcoxon rank-sum test with respect to the compared algorithm are presented in Table 12.  Therefore, H 0 can be rejected, and H a confirms that QCBOA provides the minimum values for these functions. For the functions F2, F5, F14, and F17 the value of p is greater than α; thus, the null hypothesis cannot be rejected. This implies that the BOA value is equivalent to QCBOA, or that BOA dominates over QCBOA to produce optimal results. For the functions F8, F19, F20, F21, F23, and F26 w QCBOA lies between the maximum and minimum rank limit values. This shows that QCBOA and BOA produce a mixed ranking. However, as the p value is below α, H 0 can be rejected and QCBOA outputs more optimized results for the majority of runs (although not for all 50 runs). A similar analysis is conducted with PSO, DE and GA; the best values for which  QCBOA dominates are indicated in bold faced in Table 12. A win for QCBOA over the compared algorithm is represented by '' ''; similar performance is indicated by ''= '' and failures are indicated by '' ''.

F. COMPLEXITY ANALYSIS RESULTS
In this section the time complexity and space complexity of the proposed QCBOA and the original BOA is analyzed in terms of the computer's central processing unit (CPU) run time in seconds and the size of working set of the process in kilobytes. The CPU time is defined as the time that the CPU is working for that specified task. The working set defines the amount of memory to execute a specified process. From the pseudocode of the proposed QCBOA depicted in Fig. 4 and the pseudocode of original BOA shown in Fig. 1, one can clearly note that the order and the number of ''for'' and ''while'' loops used are the same. However, it can be noted that some extra equations and variables are added in the proposed QCBOA. Thus, the complexity of this algorithm arises in terms of the space and time required by the processor to execute the set of instructions of the algorithm. Table 13. Shows that the QCBOA requires higher execution time and little more memory requirement as compared to original BOA. This is due to the additional memory usage and progressive changing behavior of variables as compared to original BOA. However, for offline optimization problems VOLUME 9, 2021  (similar to the presented in this work), small increment in CPU time and memory is not a major concern if the algorithm provides better overall results.

VII. CONCLUSION
In this paper, we have proposed the QCBOA to overcome the primary limitations of the original BOA. In the proposed QCBOA, we implemented different chaotic maps to handle sensory modality and power exponent functions, which are critical relative to calculating the fragrance parameter that determines butterfly movement. In addition, the position updation of exploration of butterflies was replaced by the quantum wave technique and the probability switch was replaced by a ranking strategy based on the fitness value of the butterfly's position. We also permitted butterflies of lower rank to move randomly based on the quantum wave concept, which enables the butterflies to explore the search space effectively with random movement Finally, in the proposed QCBOA, exploration and exploitation are balanced by employing a cooperative nonlinearly time-varying strategy that determines the percentage of the population performing the given search type. An extensive comparative evaluation was conducted to demonstrate the reliability and efficiency of the proposed QCBOA compared to the original BOA and BOA with chaos. The comparison is made with 20 commonly used benchmark functions and also travelling salesman problem. The results demonstrate that the proposed QCBOA outperforms the compared algorithms and provides better results for approximately 75% of the evaluated 20 benchmark test functions. Similarly, QCBOA outputs superior results than BOA for the solution of TSP. For parameter optimization of PV system, QCBOA also provided a better result. Currently research is underway to test the performance of the proposed QCBOA in various real-world problems such as optimum placement and sizing of electric vehicle charging station planning and parameter optimization of complex fuel cell systems.