Algorithmic Verification of Constraint Satisfaction Method on Timetable Problem

Various problems in the real world can be viewed as the Constraint Satisfaction Problem ( 𝐶𝑆𝑃 ) based on several mathematical principles. This paper is a guideline for complete automation of the Timetable Problem ( 𝑇𝑇𝑃 ) formulated as 𝐶𝑆𝑃, which we are able to solve algorithmically


Constraint Satisfaction Problem
Thanks to appropriate algorithms, we can solve difficult problems which we call -complete [1], whose analytical calculation would be impossible. This class includes a lot of other mathematical problems (Boolean satisfiability problem, Travelling Salesman problem or Graph -coloring problem, etc.). However, in order to successfully solve the problems that we encounter in everyday practice, we need to be able to characterize each of them appropriately so as to find a mathematical prescription for its solution.
The Timetable Problem is nowadays solved on the computer (rarely manually), but most often only semi-automatically at the level of the timetable creator's activity method. The creator controls a smart editora programme that supports and controls his or her activities. The programme is usually designed to offer possible partial solutions (ensuring parallel supervision of timetable creation in the environment of educators, study groups and classrooms) to assist in the selection of possible solutions (which arise from "overlapping" timetables of individual environments), allowing the selected solution to be registered in all three environments (or accept changes in the timetable) or monitor the status of the timetable creation process (how many subjects have not yet been included, how many conflicts have been created during the timetable creation and suchlike).
A number of important problems in mathematics (e.g. in graph theory, set theory, algebra, etc.) and in everyday life can be easily described as so-called Constraint Satisfaction Problems ( ) with the appropriate constraint language, a set of relations over a set of values. There is a relationship between the "power of language" and the problems that can be expressed in some language [2]. The advantage of formulating the problem as a due to the commonly disparate structure of the problem is the ability to work out any problem as a mathematical object and to solve any problem algorithmically. In this way, a purely theoretical solution to the problem becomes applicable to almost anything. We can understand as trying to find such a solution from the information we have about the problem, so that all the conditions (constraints) of the problem are met. The constraints determine the properties of the solution, and most of the time, they create a whole set of possible solutions. A characteristic feature of the general is that it is an -complete problem [3] that cannot be solved analytically. Therefore, it is typical for solutions using various algorithms by taking advantage of computer "power", and this part of mathematics (closely related to computer science) has gained importance with the advent of computers. A typical and known is the Eight Queens Problem [4], [5].
For simplicity, every problem is made up of a set of variables that are displayed in a set of values. Then, all possible assignments of values to variables that are considered in s are called a state space, and the problem can be solved by searching in the state space. The state space of the problem can be imagined as a plot graph of the -dimensional function projected into the plane by suitable mapping, whose vertices correspond to the state of the problem solution and the vertices' lines (edges) correspond to the operations changing the state to another. The solution to the problem then has the nature of searching for possible paths between the vertex corresponding to the initial state of the problem solution (e.g. randomly selected) and the vertex corresponding to the target state conditions. The best solution is always presented by the vertex that is the global minimum of the function, and therefore the searched function must be thus constructed [6] [7].
When searching in the state space, we can only be interested in finding a solution or finding the best solution (global minimum). Often (e.g. because of the size of the problem) the problem is simply divided into related subproblems (if this is permitted by the problem itself in any way), which we can solve more efficiently, and then we can suitably put them together to solve the original problem (e.g. using the Graph Structure). This greatly improves the search for a solution, but such a problem-division strategy is only effective in most cases. In addition, it always depends on the choice of algorithm that primarily influences finding the solution and the efficiency of the search itself.
The theory of constraints is currently dedicated to how to define constraints, what relationships must apply between them, and how restrictive they may be (sufficient and necessary constraints) to make the complex problem practically solvable. However, mathematical theory is built as algebraic, graph and database one. The main direction in future research is mostly the application of algebra knowledge [8]. The more that is known about valid relationships between problems, the better any problem can be mathematically described, simplified, or transferred into an equivalent problem, and the sooner we will be able to deal with it and completely solve any problem as a practically solvable task. Constraint programming is becoming a key technology for solving many combinatorial problems. is called the field of the constraint, and the number of elements ( ) in the relation the arity of the constraint. Then, with relation , all allowed combinations are exactly determined with respect to the variables in field . Thus, the unary constraint specifies all allowed values for one variable, and the binary constraint does so for all allowed combinations of values for the ordered pair of variables. As a result, the above example of the constraint would be written as the set:
The second notation of constraint is particularly useful when defining the constraint over infinite domains (which is not the case with most s we need to solve in practice). Meeting the constraint means to assign such an -tuple of values (or a combination) [ 1 , … , ] to the field of variables that are from the relation. We write ( 1 , … , ) = | 1 , … , | = 1. Then, the consists of variables that acquire values from the associated domains and the constraints placed on the variables. If the constraint is met, we say that the values assigned to the variables are consistent. Otherwise, they are inconsistent.
The constraint fulfillment process is an envisaged solution to the problem as a gradual fulfillment of specified constraint conditions. In the solution procedure, the initial set of values from the domain is gradually kept under constraint until a set satisfying the specified constraints is obtained. If the domain values are not consistent with the given and derivable constraints [9], [10], [11], they are removed from the domain, leaving in it only those that meet all the constraints. Gradually, by meeting the constraints, we get a set corresponding to the target state, or we find out that the problem has no solution. Thus, the consistency of variables is preserved by this process.
We can say that is = ( , , ) consisting of: Each of these problems has a different complexity (and therefore a different choice for the solution search process), so it is always necessary to realize which subproblem we are trying to solve before solving the problem itself. Now, let = { 1 , … , }, ∈ be a set of variables. Let = { 1 , … , }, ∈ be a finite domain for variables , = 1, … , . Then, mapping ℎ ∶ → of the set of variables into the set of variable values the way that ∀ = 1, … , : ℎ( ) = , ∈ , = 1, … , is called the interpretation of variables of set .
The solution of the particular is such an interpretation of the variables that each constraint is fulfilled (i.e. each field is an element of the relevant constraint relation). The mapping can be written down as ℎ ∶ → , že ∀ , = 1, … , : ℎ( ) ∈ ( is the number of constraints, ℎ( ) is the result of applying the function ℎ to the field , if, for example, ). Formally, we write down ∀ , = 1, … , : |ℎ( )| = 1 . The set of solutions is denoted ( ). Next, let be a set of all finite relations over set . Then, for each set of relations ⊆ the class of all s whose constraint relations are elements of the set is denoted ( ). The set specifying the is called a constraint language. Simply, the more relations that are included in the constraint language, the more constraints can be expressed. This property is called the power of language. Naturally, if we increase the power of the language, the corresponding problem becomes more difficult to solve.
If there is an algorithm that solves every instance of the problem in class ( ) by polynomial time complexity, class ( ) is a class of problems, and the set of relations is a so-called set of practically solvable relations. On the other hand, if ( ) is -complete, we say that the constraint language is -complete [12].

Possible Approaches to a Solution
In order to solve a , we need to find such an assignment of values to the variables so that all the required constraints are met for the solution. For small values | | or in the case of "simple" problems, we can decide about by analytical calculation. However, once the number | | is increased (for most s it is enough to talk about | | > 2), it becomes "inconvenient" to look for the solution itself or even just the number of solutions for the class of problems. On the other hand (in the knowledge of deeper theory), it is possible to find at least partial (incomplete) solutions of some s on the basis of various simplistic relationships or the equivalence between problems. So far, the only possible way for -complete problems is using algorithms. In this section, we will describe the BACKTRACKING algorithm as a possible approach to a solution. The choice of the correct algorithm is dependent on the specific instance and structure. There is no universal prescription that is able to determine which algorithm to use and which has a greater "power". It may happen that a class is better addressed by an algorithm that would not be "the one prescribed". And even just some instance of the class. It also depends on whether we are looking for only the number of solutions or the solution itself, or even the best solution. Thus, there is an additional problem with the , which is to decide which algorithm is to be used to solve the . Various problem-solving techniques have been studied for decades, and efforts are currently concentrated mainly in the field of genetic algorithms or various local search methods [13], [14].
We know that the problem is solved by searching the state space, which can be complete or incomplete. A complete search of the state space is such a search that finds a solution or finds that a solution does not exist. An incomplete search of the state space search is a search that is not complete. Thus, an incomplete search may or may not find a solution, even if the solution exists (or, it finds out that the problem does not have a solution). Alternatively, it finds just an incomplete (partial) solution to the problem (depending on the nature of the ). The big advantage of an incomplete search is its speed. A partial solution to a is such a function ℎ ∶ → , ⊂ that for all that we consider for , ℎ( ) ∈ . Whether we search the state space completely or incompletely depends on the choice, and hence the properties of a particular algorithm, and especially on the itself. For many problems, it is not usually possible to opt for an algorithm that would search completely (e.g. due to exponential time complexity). Depending on the nature of the , we can use an algorithm that assigns values from the relevant domains (a so-called initial solution) randomly or by certain rules to all the variables that we work with in the , so that all the solution constraints are met (or, by some rules, generating assignments to variables until the constraints are met). Alternatively, the solution is designed, which is the most common solution. Constructive algorithms seek solutions based on simple deterministic rules. Any can be solved by trying all the options. This method is called generate and test when every possible combination of values from the domain for the problem variables is systematically generated and tested until all constraints are met. The first combination of values that fits all the constraints of the solution is the solution. The number of combinations we need to go through is the number of Cartesian product elements of the domains of all variables. The method is very inefficient and computationally difficult, so it can be used "at most" for class problems. The time complexity of the algorithm is always exponential, and it searches the state space completely.
A more successful method is a recursive search (so-called BACKTRACKING) [15], which is a certain approach to a range of difficult issues and is generally applicable to a . The formal algorithm form is as follows: BACKTRACKING checks for the constraints to be met whenever the algorithm assigns values to all the variables considered at that time. The algorithm is recursive and consists of examining the finite number of subtasks. The process of finding a solution can be seen as a process of repeating attempts to gradually build a state space search tree that usually grows exponentially. However, the time it takes to find the solution depends on: 1. the details of a specific instance of the class of problems 2. the arrangement of problem variables 3. the arrangement of domain values In some cases, the BACKTRACKING(i) search procedure can find a solution without performing a backward step, so the time complexity of the problem would only be proportional to the number of variables in the input sequence. BACKTRACKING searches the state space completely and chronologically (often referred to as a recursive chronological search).
Nowadays, the effort of people involved in the creation of algorithms is to improve the "standard" recursive search, mainly for the purpose of its acceleration. Essentially, it attempts to achieve this acceleration by using extra problem information to search efficiently, thus making fewer unnecessary value assignments from variable domains; that is, when searching, the two variables can be re-assigned the values that have been tested and do not match the constraints. In this way, some parts (branches) of the state space would be searched unnecessarily. Some heuristics make it possible to adapt to new conditions by changing the algorithm, thus finding a solution differently. This is because not all the information may be available to solve various real problems in the initial state of the solution. These are gradually acquired over the course of the solution, and their accumulation can lead to a situation that requires reformulation of the original problem, thus addressing a completely new problem. Using different heuristics reduces the search tree, reducing the complexity of time-consuming exponential complexity. However, just like in BACKTRACKING, the computational complexity of the algorithm is exponential. Although this is less common than in standard searching, we cannot predict the actual computational complexity of the problem instance solution nor its average estimate. Therefore, the least desirable alternative is again considered.

Timetable Problem as an Optimization Problem
A Timetable Problem ( ) is another specific case of an , and it requires some combinatorial and optimization capabilities. It is based on different information that respects itself through different constraints. The solution to the problem is usually a "table" consisting of time units and days of the week. Especially for school timetables [16], the time unit is a lesson that consists of a teacher, a room, and a study group. Such a table serves as a predetermined plan to guide the pedagogical process that must be built to resist minor changes, such as a visit to the school that causes a study group to move to another room.
Different requirements placed on the timetable are labelled necessary or complementary. Necessary requirements must always be met and define the characteristics of the timetable. Without them, the timetable would not be applicable (e.g. it is not possible for the teacher to be in two different places at the same time). Additional requirements may not always be met, although they must be respected as much as possible. They make the timetable more acceptable (e.g. the teacher does not have to teach in the morning and in the afternoon as well). Essential requirements for the timetable are the teachers' (usually when they can or cannot teach), the study groups' (to be at all available), or a requirement for non-compliance (such as the number of rooms). Similarly, the requirement that two classes do not have the same teacher, room or study group is applied as necessary. However, the allocation of the necessary and additional requirements depends on the timetable creator. A common supplementary requirement is the requirement of a special room in which teaching is to take place. Thus, in addition to choosing the right algorithm, the creator of the timetable determines the solution constraints (modelling the problem) according to what timetable he or she creates (for what purpose, for what type of school, etc.).
Achieving the goal depends largely on the algorithm's ability to find the most appropriate solution to the problem from all of its solutions. In order for the algorithm to make the right decision about the solution, it is necessary to set appropriate constraints and criteria for decision making. Based on the previous sections, we can conclude that it is not possible to find a sufficiently fast algorithm to solve a general which is -complete. However, the speed itself depends on the nature of the being solved, because for some problem instances the same algorithm can work in polynomial time and for others in exponential time. Furthermore, the success of the solution is also based on selecting the right algorithm according to specific requirements. It may happen that a certain "super" efficient algorithm is well managed for a difficult general , but easy instances of the problem are solved more slowly than when solved by another, less efficient algorithm.
However, the successful processing of easy s is usually possible using any algorithm. The value of the polynomial is still "acceptable" even for a larger input range, and the calculation would in principle always be manageable. However, to find the optimal solution for general difficult s, we need an algorithm with the growth rate of a complexity function exponentially, and therefore the correct formulation of the problem is inevitable (otherwise we would look for a timetable "for years"). Although current technology has not yet exhausted all the possibilities of accelerating calculations by increasing the technical parameters of computers, there are still physical boundaries that do not allow unlimited computing speed. In addition, increasing computer parameters will affect the acceleration of the calculation to a lesser extent than applying an effective algorithm to an efficiently formulated problem. In the case of exponential time complexity algorithms, any computer acceleration will not fundamentally help us (perhaps just the solution on a large number of computers at the same time, but in that case, the model is very complicated to find because of complex communication rules). The right system coupled with the right solution-finding principle can be designed by appropriately defining the problem. It is possible to reduce the number of attempts needed to find a solution (or finding out that the solution does not exist), being the constraints that offer this possibility.
Let us focus our attention on school timetables. A is an optimization problem [6], [7], and therefore the problem is solved by searching the appropriate state space. To find a solution, we set out to: 1. find some (unoptimized) solution 2. find an optimal (complete) solution 3. find a good (partially optimized) solution It is virtually impossible to find the optimal solution for a general (because of the nature of the problem) while meeting all the necessary and additional requirements. Moreover, it is very difficult (or even impossible) to decide whether the optimal solution found is the best one (is it better to teach maths on Mondays or Tuesdays if it is possible on either day?). Mainly (in formulating a larger-scale ), it is not even possible to choose an algorithm that searches the entire state space because of time complexity. That is why we will be satisfied with a good solution meeting all the necessary and some additional requirements. Only finding a solution which is possible in the shortest time when just the necessary requirements are met is not a very desirable condition. With that timeframe, we can try to adjust the input word of the problem if possible (e.g. choose different rooms for certain subjects or otherwise specify some constraints). It is necessary to characterize the input differently when finding an incomplete solution. Our model is formulated only with the necessary requirements, so the solution we are looking for is complete.
As mentioned, a is an -complete problem. One way to show this is to find a problem that we know is -complete and is an equivalent problem to a (or is of the class and can be reduced). Such a problem is -colourability of the non-oriented graph [1] [17]. In the graph model, the vertex represents a class and the edge stands for a time slot. Two classes that have some resources in common (where the resources mean teachers, rooms, etc.) are displayed at such vertices of the graph that are bound by the edge. Class scheduling for time slots is then controlled by vertex colouring [18].
Let us consider sets of rectangles so that for ∀ , 1 ≤ ≤ we have a set of beginnings × and a set of sizes × . The task now is to select rectangles so that they do not overlap in pairs. More specifically, for ∀ , 1 ≤ ≤ it is necessary to find the beginning ( , ) ∈ × and the size ( , ℎ ) ∈ × , so that: The polynomial reducibility of the problem, that is "Sequencing with release times and deadlines," shows that such a selection of rectangles is an -complete problem [19]. Hence, the rectangle problem is a .

Universal Formulation of a as a
A time slot is the time in the timetable that we assign to a unit class. We assume that there is a constant length of break time (which we do not pay attention to) assigned to time slots. We do not assume that teaching is carried out at remote locations, and therefore there is no need for more time to move between classes. A block of classes is made up of two consecutive time slots which are not separated by a break (this is generally the most common case in schools) and are assigned the same resources.
Let the number of teaching days and the number of time slots (not necessarily the same for each day) be given in advance (e.g. by school management). Let us also assume that the school determines the subjects taught and assigns the teachers to the individual subjects. Next, let any combination of subjects be admissible for students who are assigned to study groups. We assume that students are available for class at any time.
If the number of students choosing the subject is large, we will assign students into groups that we call subject groups. We further assume that all groups for the same subject are in class the same number of hours. Assigning a student to a subject group means assigning him or her to all the classes of the subject. It is thus sufficient to assign the student only to his or her study groups.
A is then characterized by the input word 1 , which consists of input of time, input of teachers, input of rooms, input of subjects, input of study groups and input of classes. All input sets are assumed to be non-empty.
= ( , , , ) characterizes the input of time where is the finite set of time slots, is the finite set of days, ∶ ⟶ where ( ) denotes the day of the time slot ∈ and ∶ × → , where = { , } ⇔ {0,1} is the set of truth-values, and function ( 1 , 2 ) expresses whether two time slots 1 , 2 ∈ are a block of classes. The relation is symmetric because ∀ 1 , 2 ∈ : ( 1 , 2 ) ⇔ ( 2 , 1 ). But it is not reflexive because ∀ ∈ : ( , ) ⇔ 0. Pair = ( , ) characterizes the input of teachers, where is the finite set of teachers and ∶ → ( ), where ( ) is the potent set of the set and ( ) denotes the set of time slots when the teacher ∈ is available. = ( , , ) characterizes the input of rooms, where is the finite set of rooms, is the finite set of room types and ∶ → , where ( ) denotes the room type ∈ . = ( , , , , , ( ), ( )) characterizes the input of subjects, where is the finite set of subjects; is the finite set of class years; is the finite set of subject groups; ∶ → , where ( ) denotes the subject of the subject group ∈ ; ∶ → , where ( ) denotes the year in which the subject ∈ is taught; ( ) ∶ → , where ( ( )) denotes the upper limit of the number of hours of subject group ∈ that can be taught on the same day, is the set of natural numbers; and ( ) ∶ → , where ( ( )) denotes the maximum number of students who can be assigned to any subject group ∈ .
According to their study programme, we put together individual students in study groups. All students of the study group attend classes together. The study group is made up of at least one student and, at the most, of all students attending the school.
In total, 1 = ( , , , , , ). Let us use to denote the set of proper pairs ( , ) ∈ × , hence = {( , ) ∈ × , ∈ ∧ ∈ ( )}. Let function ∶ → ( ) yield the set of subject groups for each subject, thus for ∈ ( ) = { ∈ , ( ) = } is the set of subject groups. Then, let us assign the study groups to one possible subject. Thus, assigning the subject groups is function ∶ → , where ∀( , ) ∈ : ( , ) ∈ ( ) . The time slot assignment consists of assigning classes to time slots, hence the function ∶ → . The room assignment consists of assigning classes to rooms, hence the function ∶ → . Let us set the constraints. Let function ∶ → ( ) yield the set of subject groups for each subject. For the given time slot assignment , let function , ∶ × → ( ) yield the set of group classes for the subject assigned by the time slot on a specific day, that is , ( , ) = {ℎ ∈ , (ℎ) = ∧ ( (ℎ)) = } . Then, if the upper limit of the number of hours for each day of the group ∈ for the subject that can be taught on the same day is ( ( )), then for ∀ ∈ ∀ ∈ it must hold true that | , ( , )| ≤ ( ( )).
Let be the given time slot assignment. Let ′ ⊆ be the set of classes that share certain resources (rooms, study groups, subject or teacher groups). Then, it must be true that ∀ℎ 1 , ℎ 2 ∈ ′ : ℎ 1 ≠ ℎ 2 ⇒ (ℎ 1 ) ≠ (ℎ 2 ) while none of the two hours sharing the resources can be assigned into the same time slot. Let us denote this constraint as ( ′). Let be the given room assignment. Let the function ∶ → ( ) return for each room ∈ the set of classes ( ) = {ℎ ∈ , (ℎ) = }, assigned to the same room. Then, for ∀ ∈ the constraint ( ( )) must be met. For the given input of classes we will determine the set of classes for each group ∈ for the subject as function ∶ → ( ) where ( ) = {ℎ ∈ , (ℎ) = } . Then, ∀ ∈ and the constraint ( ( )) must be satisfied.
If pair ( , ) ∈ has been assigned to subject group = ( , ), then study group ∈ must attend each class of set ( ). Let be a given assignment for subject groups. Let ( ) be a set of the subject groups to which the study group ∈ has been assigned, hence ( ) = { ∈ , ∃ ∈ ( ): ( , ) = } . Then, for each study group ∈ , the set of classes of study group ∈ is the set of classes to which study group ∈ has been assigned, hence ( ) ⋃ ( ) . Then, two different classes of the same study group cannot be assigned to the same time slots, and given that ∀ ∈ constraint ( ( )) must be satisfied.
Let ∀ℎ ∈ know the teachers of each class, that is, set (ℎ). Then, function ∶ → ( ) displays each teacher for the set of classes that he or she teaches, thus for ∀ ∈ the set of classes the teacher teaches is ( ) = {ℎ ∈ , (ℎ) }. Then, ∀ ∈ and constraint ( ( )) must be met. In addition, for teachers, we assume that not all time slots are always available (e.g. they work part-time). Therefore, it is necessary to use such a constraint to make the time slot assignment impossible for the time slot when he or she is not available. Let be the given time slot assignment. Then, this assignment matches the teacher's availability, and if ∀ ∈ and ∀ℎ ∈ ( ), it holds true that (ℎ) ∈ ( (ℎ)). In most schools, some rooms are designed for teaching special subjects (e.g. laboratories and gyms). In that case, certain subjects can only be taught in these special rooms. This is ensured by the following constraint: let be the given room assignment. Then, ∀ ∈ denotes room type . Set (ℎ) is the set (of types) of matching rooms for class ℎ ∈ . Then, for ∀ℎ ∈ it must be true that ( (ℎ)) ∈ (ℎ). The capacity of the subject groups is limited, and we want the subject groups for the same subject to be approximately the same size. Thus, all groups ∈ ( ) for subject ∈ cannot exceed a certain number of students. This is ensured by the following constraint: let be the given group assignment for the subject. Then, ∀ ∈ and for the corresponding subject = ( ) the set ( ) = { ∈ , ( ) ∈ ( ) ∧ ( , ( )) = } is the set of the study groups assigned to group ∈ for the subject. Let ( ) denote the size of study group ∈ . Then, assigning to the subject groups matches the upper limit of the group size for the subject. If ∀ ∈ , ∀ ∈ ( ), the maximum number of students of the group for the subject ∀ ∈ ( ) is less than or equal to the given upper limit ( ( )) . Thus, it must hold true that ∑ ( ) ≤ ( ( )) ∈ ( ) . Furthermore, it is necessary to set constraints for hour blocks that exclude those solutions that would not meet them. Two hours in the block must be assigned directly to consecutive time slots and the same room. The given time slot assignment matches the block of hours only if ∀ℎ 1 , ℎ 2 : (ℎ 1 , ℎ 2 ) ⇒ ( (ℎ 1 ), (ℎ 2 )). The given room assignment matches the block of hours if and only if ∀ℎ 1 , ℎ 2 , (ℎ 1 , ℎ 2 ) ⇒ (ℎ 1 ) = (ℎ 2 ). Then, 2 = ( , , ) is the complete solution if all assignments to all the variables considered are consistent, so all the constraints are met. If not all variables have an assignment but the constraints are met, the solution is called partial. Our task is to find a complete solution without evaluating the solution.
The time complexity that is polynomial for this (simplified) model [16] has been reflected in the rate of generation in our created programme. The generation process is captured on the graphs as follows (Figure 2 - Figure 6).    A complete solution (Figure 7) has always been found up to 30s (on average in 27.6s). From the graphs listed in the annex, it can be seen that the generation had approximately the same pattern (the algorithm behaved "similarly" despite the RANDOM heuristics used).

Conclusions
The aim of the paper was to find a suitable mathematical formulation of the Timetable Problem, which is modelling the Timetable Problem as a Constraint Satisfaction Problem with reference to the general possibilities of algorithmic solution. Then we verified the model algorithmically and experimentally in the created program. From this point of view, the work is largely devoted to algorithms as an effective problem-solving tool. Despite the fact that we are able to solve (and effectively solve) a number of problems by way of the Constraint Satisfaction Problem, this notion is not well-known, and the constraint options are not exhausting. The theory of constraints (dealing with problems and their properties, simplifying problems or effective ways of solving them) as a separate theory is currently being originated (although its content is familiar to mathematicians). There is no literature completely describing the properties and relationships to enable us to express any problem as the Constraint Satisfaction Problem (or simplify it) so that we can solve it or at least decide on the solution. Perhaps the greatest knowledge is contained in Constraint Logic Programming or Artificial Intelligence. However, the constraints are sure to be the right way to model and work out problems. Even the different challenging issues, if properly mathematically formulated, can be easily solved algorithmically.