# Improved BIRECTv Algorithm based on a New Approach for the Identification of Potentially Optimal Rectangles

## Description

This codes are used as the basis for the following preprint by : N. Belkacem and L. Chiter "Improved BIRECTv Algorithm Based on a New Approach for the Identification of Potentially Optimal Rectangles". BIRECTv is modification suggested to the recently introduced BIRECT (BIsection of RECTangles) algorithm. A new deterministic approach, named BIRECTv algorithm (where v stands for vertices), combines bisection with sampling on diagonal vertices. Also, a new variation of the BIRECTv algorithm, called BIRECTvl- is also introduced. This MATLAB code performs optimization using a multi-division algorithm. The code optimizes various test functions and applies a multi-division strategy to find the optimal solution within a specified tolerance. The code is based on the following steps: Define test functions: The code contains a set of predefined test functions like Ackley, Bohachevsky, Beale, Branin, Dixon & Price, Griewank, Hartman, Matyas, Michalewics, Rastrigin, Rosenbrock, Schwefel, Sphere, Trid, Zakharov, and others. Each test function has a specified domain and a known global minimum or maximum. Set optimization parameters: Parameters like the maximum number of iterations (nmaxit), the maximum number of function evaluations (nmaxfun), tolerance (epsilon), pe (percent error), and other options related to graphics and display are defined. Initialize optimization: The algorithm starts by initializing variables to store the function values (f), the rectangle boundaries (A and B), and other relevant data. Main optimization loop: The algorithm enters a loop where it repeatedly divides rectangles into smaller sub-rectangles until a stopping criterion is met. It keeps track of the best minimum (f_min) found so far and the corresponding optimal point (x_min). Rectangle division: The algorithm divides each rectangle into sub-rectangles based on potentially optimal rectangles. It maintains a list of potentially optimal rectangles that need to be further divided. Convergence and display: The algorithm checks for convergence conditions like the percent error (pe) and the maximum number of function evaluations. It also provides graphical representations of the optimization process and the convergence plot. Output: The algorithm outputs the optimal solution (xmin) and the corresponding minimum value (fmin), along with other relevant information about the optimization process. It's important to note that the code assumes the existence of a function "f" that takes a vector of inputs and returns the value of the objective function to be minimized. Additionally, the test functions are predefined, and the code selects one based on the value of "example" (e.g., "example=9" selects the Branin function).

## Files

## Steps to reproduce

Matlab codes written by : Author 1 : Naziheddine Belkacem Author 2: Lakhdar Chiter BIRECT-V algorithm ( is a modification of the BIRECT (BIsecting of RECTangles). How to run this program? Go to Birect2.m file, and comment lines 1 and 4 if you want to run many or all test problems from (there are 54 test functions described in the file f.m). Then go to file all_examples and run for example functions from 1 to 12. Click on the file results.txt. The program will display: The function number, the obtained value of f : f(xmin), and the number of function evaluations (f_eval), with the average and median values. You can also get the CPU time displayed by uncomment corresponding lines in the file (tous_exemples). If you want to run only one function then uncomment the lines 1 and 4 from Birect2.m and type the number of the function in example. You can use graph=1 (for two dimensional functions), for the graphic representation, and 0 if not. In total 6 figures and graphs are displayed. The domain of certain functions have been modified (ex. fct. 13, 39, etc..) to get the required results (f_min and x_min). In the file po_opt.m, you can either run BIRECT-v or BIRECT-vl : uncomment ind2=find(mn==D(I),1,'first'); and comment ind2=find(mn==D(I)); to run BIRECT-vl %%% %%% do the opposite if you want to run BIRECT-v %%% %ind2=find(mn==D(I)); ind2=find(mn==D(I),1,'first'); ind2=I(ind2); The file median-average is auxiliary and helps to get the median and the average from any results. %%%%%%%%%%%%%%%%%%%%%%%%%% The code for BIRECT is available at : https://data.mendeley.com/datasets/t6vv9yknbc Any suggestions or corrections are welcome. email me to: lchiter@univ-setif.dz