SOLVING OPTIMIZATION PROBLEM USING MATLAB PACKAGE

Valentina Khotskina Associate Professor PhD, Kryvyi Rih Economic Institute Kyiv National Economic University named after Vadym Hetman, e-mail: hotskina_vb@kneu.dp.ua, http://orcid.org/0000-0001-8963-4189, Ukraine Nykolay Khodukin Senior Lecturer, Kryvyi Rih Economic Institute Kyiv National Economic University named after Vadym Hetman, e-mail: hodukin@kneu.dp.ua, http://orcid.org/0000-0001-8577-2541, Ukraine Zhanna Tsymbal Senior Lecturer, Kryvyi Rih Economic Institute Kyiv National Economic University named after Vadym Hetman, e-mail: thymbal_jv@kneu.dp.ua, http://orcid.org/0000-0003-3468-8627, Ukraine


Introduction
The task of the study is to analyze existing approaches to solving linear programming problems and to determine the solution that will be the most appropriate in the accepted conditions.The object of the study is the process of finding the optimal way of solving linear programming problems.The subject of the study leads to optimization of the process of finding the optimal method of linear programming with using the MatLab package functions, GNU Octave, MS Excel solution search add-on, the Loop Solver component of the тwell as the package GNU Octave, add-ins "Find solutions" of the MS Excel application and the "Solver" component of the LibreOffice Calc table processor are analyzed.
On the example of a specific problem, a system of inequalities is compiled and a goal function is constructed.The linprog function of the MatLab package calculates the optimal value and the extreme value of the objective function.A similar solution is implemented using the GNU Octave package.Calculations are performed using the glpk function.Next, you solve this task using the Excel application, using the "Find Solution" add-on package and LO Calc table processor solver.When comparing the results of solving the problem posed by using the MatLab package and the Excel application, we can conclude that they coincide.As a result of comparing the results of the solution obtained with the use of various means, we come to the conclusion that the results coincide.The results of the research are planned to be generalized for the performing of individual student tasks, coursework, writing qualification bachelor's and master's works.Mathematical modeling is used to study an object where the object itself is not studied, just its model, which is confirmed with the perceptible object, and gives information about the modeled objects when studying the model.

Optimization problem solving
Optimization models are applied in economic and technical areas, the purpose of which is to select the optimal balanced solution in specific conditions.MatLab includes Optimization Toolbox, which is designed to solve linear and non-linear optimization problems.There is a possibility to search quickly the optimal solution path with the help of MatLab package, which uses Optimization Toolbox functions.This allows customizing the selected function to effectively task solving.The interface of these functions is quite flexible, they all make it possible to handle a variable number of input and output arguments depending on the task data and the required values.
Using the capabilities of the package MATLAB we will solve the problem of linear programming.To produce some building material, we need less than or equal to 10 kg of substance A and no more than 12 kg of substance B are necessary.Substance A can be obtained from two minerals: 1 kg of the first mineral contains 100 g, the other contains 400 g of substance A.
Substance B is also obtained from two minerals: 1 kg of the first mineral contains 0.3 kg, the second contains 0.2 kg of substance B. The total costs of minerals must be 20 kg, and the consumption of the first mineral is at least 2 kg.The cost of the first mineral is 30 UAH, the second is 25 UAH.The task is to determine the expenses of output minerals with the minimum cost production of building materials.
Sample task.As the unknowns, х1 is taken as the amount of the first mineral in the substance and х2 is taken as the amount of the second mineral in the substance.
First, we will develop an inequality system: Objective function is The linear programming problem is to find the vector x, which minimizes the objective linear function , where f is the vector of coefficients, and satisfies the given linear constraints: inequalities and equalities .In addition, two-sided component-wise constraints in vector form can be set.In the MATLAB environment, linear programming problems are solved with the help of the linprog function.The main input data of linprog are: coefficients vector of the objective function F, matrix of inequality constraints Aeq, the vector of the right sides of inequality constraints B, matrix of equality constraints, the vector of the right sides of equality constraints beq, lb vector placing x limit below, vector ub placing x limit upper.On return, the linprog function gives the optimal value x of the problem and the extreme value of the objective function (Anufriev, Smyrnov, Smyrnova, 2005).
Statement of the problem: in accordance with the requirements of Toolbox, we write down the objective function F, the matrix A, elements of which are the coefficients of the inequalities unknown in the system, the vector B, elements of which are the given constraints.

69
You also need to specify the vector lb which is a vector of restrictions.Required values are x1, x2.
Since the linear constraints must contain "less than or equal to", and the task contains the constraint "greater than or equal to", then the signs of both parts should be changed in the inequality of the system that contains such a restriction.Next, we compose a file program and use the linprog function to perform calculations (Fig 1 .).

Fig. 1. Optimization problem solving using Matlab package
As a result of solving the problem using the MatLab package, we obtained the required values х1 = 2, х2 = 18.The value of the objective function is F=510.
Substituting the obtained values of х1 = 2, and х2 = 18 into the original system of equations and into the objective function, we get: Objective function is Mathematical packages GNU Octave and Scilab compete with the leader of computational programming -Matlab.GNU Octave is a system for performing mathematical calculations that is largely compatible with Matlab.It is a convenient command interface for solving linear and nonlinear mathematical problems.The latest version of GNU Octave is 4.2.2 (released March 13, 2018).Using the capabilities of the GNU Octave package, we will solve the linear programming problem in question.
According to the given condition, a system of constraints of the task and the function of the goal are composed.In linear programming problems, the goal function and the constraint system are linear.The problems of linear programming in the Octave environment are solved with the help of glpk function.The input data is: с -column vector, which includes coefficients for unknown functions of the target, the dimension of the vector с is equal to the number of unknowns n in the problem; a is the matrix with unknowns from the left side of the constraint system, the number of rows of the matrix is equal to the number of constraints m, and the number of columns coincides with the number of unknowns n; b is the column vector which contains free members of the constraint system, the dimension of the vector is equal to the number of constraints m; lb is a column vector of dimension n containing the upper constraint system (x> lb), by default lb is a column vector consisting of zeros; ub is a column vector of dimension n containing the lower constraint system (x <ub); ctype is a character array of dimension n, which defines the type of restriction, the elements of this vector can take one of the following values: "F" restriction will be ignored, "U" is a restriction with the upper limit ((A (i,:) * x <= b (i)), "S" is a constraint in the form of equality ((A (i,:) * x = b (i)), "L" is a constraint with upper board ((A (i,:) * x> = b (i)), "D" is a double constraint (((A (i,:) * x <= b (i)) and ((A (i,:) * x> = b (i)); vartype is a character array of dimension n that defines the type of the variable xi "C" is a real variable, "I" is an integer variable; sense is a value that determines the type of the problem optimization: 1 is the task of minimization, -1 is the task of maximization (Akulich, 1986).
We will compose a file program and use the glpk function to calculate the desired values (Fig. 2

.).
Using the Octave package to solve the problem in question, we obtain the values of unknowns х1=2 and х2=18, and the value of the objective function is fmax=510.
We will accomplish the solution of this problem with the help of the MS Excel spreadsheet processor, using the setting "Solver add-in".Excel "Solver add-in" is an analytical tool that allows quickly and easily to determine when and what results can be obtained under certain conditions.

. Optimization problem solving using Octave package
To connect the addin "Solver add-in", select the command "Settings" from the Office menu.The application window "Excel Settings" opens.In this application window, select the option "Addin" and from the list that opens, select "Solver add-in."Next, to install the addin, click button "Transition to", in the lower part of the application window.A dialog box appears in which you are to tick the "Solver add-in" and click OK.In the standard Excel dialog, the addin "Solver add-in" is installed on the "Data" tab.By activating the "Solver add-in" the application window of "Solver add-in settings" will appear.
We begin the solution of the problem by inputting the initial data into the Excel cells.The name of the unknown х1is entered at the address B1, the unknown х2 -at the address C1.We highlight the cells B2 and C2, in which values of the unknowns will be displayed after the implementation of the decision.Next, at address A3, we enter the name of the objective function F =.The value of the objective function must be calculated by a given formula and placed in cell B3.The objective function is calculated by the formula: B3 = 30 * B2 + 25 * C2.Since the unknowns have not been determined yet, the result of the calculation is zero (Fig. 3.).

Fig. 3. The objective function using MS Excel package 72
Next, you are to input the restrictions.First, at A4 address, we enter the signature of the action that will be performed -Restrictions.Then we introduce the formulas for calculating the constraints of the system.We place the cursor at the address A5, and then introduce the formula for calculating the first inequality.We introduce the formula for calculating the second inequality at address A6.We introduce the formula for calculating the third inequality at address A7.At address A8 is the formula for calculating the fourth inequality: Data and formulas for the implementation of the decision are put in.It is necessary to use the Excel function "Solver add-in" to calculate.The cursor is set in cell B3, where the objective function formula is entered.Next, perform the following steps: in Excel 2010, select the "Solver add-in" option on the "Data" tab."Solver add-in settings" dialog box appears.Now we work with this dialog box.The first parameter to start working with is the Optimize Target Function parameter, which is used to select the cell address of the target function to be optimized.Since before using the function, we set the cursor to the address where the formula for calculating the objective function is located, the address of the calculated value of the selected target function cell is located in the settings application window $ B $ 3.
Setting To is intended to select the direction to which the objective function tends (Maximum, Minimum, and Values).It is necessary, according to the condition, to make a choice by setting the cursor to the position Minimum.
Setting Changing cells of variables is intended to specify a range of cells reserved for the values of unknowns х1, х2.This is a range of $ B $ 2: $ C $ 2 cells.
Setting According to restrictions: is used to enter restrictions.The cursor is placed in the application window of this setting and then you are to click the button Add.
After clicking the button Add, Restriction Add application window appears on the screen.In the field Link to cells: you are to enter the address of the formula for the first inequality by clicking the mouse cursor on the address A5.In the field where the restriction sign indicates, open the list and select the restriction sign that you need according to the condition.Then, in the setting Limit, select the address of the value of the first limit, this is C5.Next, click on the button Add.
The first inequality of the system is processed.Similar actions must be performed with the second, third and fourth inequalities (click button Add and fill in the setting fields of the application window).Having filled the last application window, click OK.Solver add-in setting application window appears on the screen.In the field of the setting In accordance with the restriction: all inequalities expressed through the addresses of Excel (Vasiliev, 2009) are reflected.
The next step in finding the optimal solution should be the choice of a method for finding a solution.To do this, in Select the solution method in the settings, open the button and select the Search for solving linear problems by simplex method from the list that appears.Next, you need to click on Find solution button: Results of Finding Solutions application window appears on the screen with the active option Save found solution (Fig. 5.).

Fig. 5. Results of Finding Solutions (MS Excel)
At the bottom of the application window the following message is displayed: Solution found.All restrictions and optimality conditions are met.To complete the solution and save the result, click OK.The Excel sheet shows the calculated results: х1=2, х2=18, and the value of the objective function F=510.
We substitute the found values of the unknowns into the original system of inequalities: The objective function equation The solution to this problem can also be done with the help of the table-based Calc processor, which is part of LibreOffice.We introduce the initial data, the formula for calculating the objective function and restrictions (Fig. 6.):

Fig. 6. Optimization problem solving using LibreOffice package
The "Solver" component allows solving equations with several unknowns using methods for solving inverse problems.The solver is integrated into LibreOffice and is activated from the menu item Tools → Solver ... The command Service → Solver opens the Solver dialog box.When working with this application window, enter the relevant information in the input fields of the application window and click button Solve.
"Result" dialog appears on the screen with a message about the successful completion of the solution process and the result corresponding to the value of the objective function (Pavlushina, 2012).The LibreOffice Calc worksheet displays the resulting unknown values х1=2 и х2= 18, as well as the value of the objective function F=510 (Fig. 7.).

Fig. 7. Results of Finding Solutions (LibreOffice)
Conclusions and Suggestions Fig. 2. Optimization problem solving using Octave package Fig. 4. Values of the restrictions using MS Excel package