Balanced Academic Curriculum: Looking For An Optimal Solution With Metaheuristics And Functional Programming

The curriculum design is quite a challenge in the academy, mainly because it requires an adequate distribution of content for the development of the expected professional competencies regarding the available time, the necessary academic load, and their gradual progress in the higher educational institutions. Considering the above, the main objective of this work is to present and exemplify a computational solution to minimize the cost of designing curriculum plans using bio-inspired algorithms to automate and reduce errors in such a process. Specifically, the purpose of this research focuses on solving the Curriculum Mesh Balancing (BACP) problem through metaheuristic optimization based on the behavior or algorithm of fireflies and the use of functional programming in the Haskell lang curricular meshes, rolling of curricular meshes, metaheuristics; firefly algorithm, functional programming in Haskell programming language. The firefly algorithm will be applied to a set of test instances to demonstrate its effectiveness. According to the obtained results, this proposal allows the efficient gathering of solutions to the problem under study.


Introduction
Rubio et al. [Rubio et al. (2019)] described that the curricular meshes are not only essential to differentiate the same careers from 2 or more institutions. These are an instrument that contains the knowledge and learning objectives that each student must achieve in a specific career designed by teachers and professors to meet future professionals' training needs, who should be able to solve common problems in their area of formation. Designing a curricular mesh is a challenge, not only because they must train a complete professional but also because students must complete it in a certain period. Addressing the same subjects many times could require additional time for their full development [Glatthorn et al. (2018)]. For these reasons, a balance must exist in curricular meshes regarding the student's probability of success. Too many branches (courses or modules) in an academic period could cause future professionals' failure; then, the academic load should be similar in each period and the minimum possible within the broad spectrum of skills and knowledge that students could acquire [Rubio et al. (2019)].
The Balanced Academic Curriculum Problem (BACP) consists of assigning courses to periods of teaching that satisfy the prerequisites and balance the load of the students in terms of credits and number of courses [Chiarandini et al., (2012)]. Castro and Manzano [Castro and Manzano, (2001)] presented the BACP together with proposing and developing a linear programming model considering the following entities and restrictions: 1). Non-optional courses (courses with their credits according to the academic curriculum). 2). According to the curriculum, academic periods correspond to a fixed number of time intervals (each academic period includes courses to teach). 3). The maximum academic load allowed (maximum number of credits and courses for each academic period). 4). Minimum academic load allowed (minimum number of credits and courses for each academic period). 5). Approval requirements for each course (students must take and approve some courses before others). The prerequisites and subsequent courses allow the generation of ordered pairs of courses. 6). A balanced distribution of the curriculum, that is, the number of credits in each academic period should be similar, ideally the same. Thus, the BACP planning horizon divides a career in academic years and each of them into periods to take the courses. The problem is to find an assignment of courses to academic periods that satisfy certain load limits and prerequisites [Rubio et al., (2018)]. This paper considers BACP as an optimization problem.
The work of [Hnich et al., (2001)] defines a structural and behavioral model for the BACP problem, while the work of [Castro and Manzano, (2001)] treats it as a problem of restrictions. In recent years, various proposals and reviews of algorithmic solutions for constrained and optimization problems have been developed with a bio-inspired approach, usually specializations or optimizations of genetic algorithms [Yang, (2010) [Yang, (2010)] is an example of such solutions whose basis of operation is the blinking patterns and behavior of fireflies in search of a potentially optimal solution.
Considering the impact of a balanced academic load on the students' performance and success, the objective of this work is to present a solution to minimize the cost of designing balanced curricular plans through the application of bio-inspired algorithms to automate and reduce errors in the design of a balanced academic curriculum [Rubio et al., (2018)]. That is, this work looks to find an assignment of courses for each academic period that optimally comply with all the entities and restrictions mentioned. Thus, this work proposes a BACP optimization solution using a bio-inspired optimization metaheuristic based on the algorithmic attraction behavior of fireflies [Yang, (2010)] implemented in the functional programming language Haskell [Hutton, (2016)], [Thompson, (1999)], [Bird, (2014)].
This work organizes as follows: Section 2 presents the Haskell programming language and the logic programming paradigm. Section 3 describes the methodology this work follows. Section 4 shows the main results. Section 5 mentions pros and cons of our work. Section 6 concludes this research.

Haskell and Logic Programming
According to [Hutton, (2016)], Haskell is a multipurpose, functionally pure, and polymorphically typed programming language. Haskell uses the lambda calculus. As a functional programming language, in Haskell, the primary or main constructor is the function. Language has its origins in the observations of Haskell Curry and his intellectual descendants for their work in mathematical logic [Hugh, (1989)].
Structured object-oriented programming languages are examples of imperative programming languages; that is, programming languages that define algorithmic solutions as a sequence of steps for executing them in the specified order. One of Haskell's remarkable properties is, due to its functional nature, which allows the definition of functions and expressions for their execution through their evaluation [Hutton, (2016)], [Hugh, (1989)]. Thus, Haskell is an example of a high-level and general-purpose programming language. Figure 1 shows the Haskell and Java code of the function to, given an integer, determine its factorial number. Note that the Haskell code is analogous to the mathematical definition or declaration of the factorial function. In contrast, the Java procedural code requires to indicate step by step each of the function's actions to obtain results. The following are the unique properties of Haskell solutions: 1. Brevity -Programs tend to be much shorter; 2. Simplicity: functional programs are usually simpler to understand; 3. No memory errors: strongly-typed solutions do not present type mismatches or memory errors; 4. Reuse: Haskell solutions have minimal restrictions to facilitate reuse; 5. High abstraction: functional programming languages use the declaration of functions, which allows reaching high levels of procedural abstraction; that is, Haskell does not rely on variable and object state changes like traditional imperative programming; 6. Memory management: Haskell does not require explicit dynamic memory management, such as in traditional imperative programming languages [Bird, (2014)], [Bird, (2014)]. According to [Hutton, (2016)], functional solutions, according to the inherent properties of functional programming, require high levels of use of both memory and computing, which required high-level computing systems in the previous decade. However, due to the advances and current availability and accessibility of highperformance computing systems, functional programming solutions are much more accessible and viable today.
Applying the FA firefly algorithm to an optimization problem requires to consider the brightness proportional to the objective function's value. In genetic algorithms, the brightness can be defined in the same sense as the objective function. Since the firefly's attractiveness or luminosity is proportional to the light emanating, Eq. (1) defines this attraction. Fig. 2. Fireflies algorithm FA. Figure 2 shows a general firefly algorithm scheme from [Durkota, (2011)] whose objective function is defined based on the objective of the problem. It is also necessary to define the initial light intensity and initialize the firefly parameters, the population size n, and the maximum number of generations (MaxGeneration). The main idea to solve the BACP proposed in this work is based on representing the problem through a binary arrangement for the evidence that it is beneficial to offer the solution-the firefly algorithm for this purpose is directly adaptable such and as presented in the next section. This research consists of developing a bio-inspired algorithm for the optimization of curricular meshes in several stages through a modular production. Hence, we chose the spiral development methodology for its greater flexibility and ease for developing incremental solutions and evolutionary programs of software engineering [Sommerville, (2010)], that is, with the gradual and evolutionary application of stages of analysis, design, implementation, and testing of defined functionalities and modules. Figure 3 illustrates this development methodology. In the context of this work, we apply the incremental spiral model in the development of four phases of prototyping: discovery, coding, validation, and optimization, with gradual incorporation of constraints of the problem together with tests to determine the validity of the minimum viable product under development and then in production.

Methodology
For the choice of solution heuristics, we use the design methodology proposed by [Bird. (2010)] that consists of using identities between functions to simplify algebraic expressions in functional programming and to optimize the implementation of functions in Haskell. We optimize the implementation of functions by using rules of inference to modify their complexity and thus designing a global repair heuristic strategy to improve the satisfaction of precedence constraints in the BACP.
This work adapts the elements presented by Rubio et al. [Rubio et al., (2018)]. The first step was to implement the original mathematical model of Castro and Manzano [Castro and Manzano, (2001)] in the Haskell programming language. We consider the precedence restriction and the academic load restriction to the set of initial solutions (initial population). Then, we apply optimization through the firefly algorithm incorporating the other restrictions of the problem.
In the algorithmic operation of the solution, first, a precedence graph is read, and then it eliminates the courses of the last period to obtain a new graph. We carry this process iteratively until getting a set of courses without precedence restrictions among themselves (elimination of precedence by blocks), to ensure that the courses in the final set do not have precedence conflicts. In this solution, functions are used that operate on lists of the form (c, p1, …, pn]) where [pi] with i in [1, ..., n] that represents the list of courses preceding pi to the course c. For example, Figure 4 illustrates the used data structure for the BACP8 instance, that is, for an eightsemester curriculum. Figure 5 presents part of the Haskell solution of this work to generate new values in a BACP matrix, specifically, for the modification of values according to Yang's firefly algorithm [Yang, (2010)]. Note that each functional definition in figure 5 presents comments (at least two consecutive hyphens precede Haskell comments).

Results
When applying the solution functions proposal in the balanced academic load optimization problems of eight, ten and twelve semesters, the results obtained are similar to those obtained in both the works by Rubio et al. Still, it allows obtaining the expected values of minimum academic load for each case. That can be seen in Figure 6 that illustrates the results after 50 runs of the solution implemented in Haskell for BACP8, BACP10, and BACP12 instances, respectively. Each run considered 500 generations of fireflies (iterations). However, in all the cases studied, the algorithm converges to the optimal solution very early (before 50 iterations). For example, in BACP8, it begins with a load of 18 credits, to descend rapidly after two iterations to the minimum load of 17. For the case of BACP10, it starts at 16 credits, and after two iterations, it reaches the value of 15, to finally, after 38 iterations, it reaches the minimum load value of 14.

Discussion
Since Haskell's random number generator is static and many of these numbers remain in memory once generated, their randomness is still difficult to control. Thus, it is challenging to develop a fully optimized program that solves the problem completely robust. We consider creating a tensor of random values in future developments to iteratively modify its dimensions depending on the size of the population, the random generation, and the execution of the solution.
Haskell is a language whose programming structure has the potential to optimize many tasks related to the calculation of long elements in a list. However, to reach a point where the type of structure of the problem can minimize the computational time until it becomes linear, we need to work with array structures. Solutions to work into those arrays can naturally run-in minimum processing cores in the machine. Precisely, the firefly algorithm solution of this work, with matrices, seeks to achieve this optimality. As indicated in the Results section, Haskell allows us to obtain a solution with a declarative character, to achieve the optimal results, even with greater efficiency in development and performance than solutions in other traditional programming languages. We implemented this work as part of an internal research project at a Chilean university.

Conclusions
This work presents an algorithmic solution to the BACP problem in the Haskell language based on the functional programming paradigm to demonstrate this approach's theoretical and practical feasibility. Thus, this work's greatest contribution is to present the viability of proposing functional solutions for optimization problems with restrictions such as the generation of a balanced academic load for study plans in higher education institutions. All the tests carried out showed that it is possible to find solutions to the analyzed cases of CSPLib. In all test cases, the solutions' quality is satisfactory and allows them to obtain the best-known solution for each instance. Currently, we work to demonstrate the effectiveness of this approach to solve real cases of the problem and socialize the simplicity of applying functional solutions to optimization problems with a declarative nature.