Другие статьи

Цель нашей работы - изучение аминокислотного и минерального состава травы чертополоха поникшего
2010

Слово «этика» произошло от греческого «ethos», что в переводе означает обычай, нрав. Нравы и обычаи наших предков и составляли их нравственность, общепринятые нормы поведения.
2010

Артериальная гипертензия (АГ) является важнейшей медико-социальной проблемой. У 30% взрослого населения развитых стран мира определяется повышенный уровень артериального давления (АД) и у 12-15 % - наблюдается стойкая артериальная гипертензия
2010

Целью нашего исследования явилось определение эффективности применения препарата «Гинолакт» для лечения ВД у беременных.
2010

Целью нашего исследования явилось изучение эффективности и безопасности препарата лазолван 30мг у амбулаторных больных с ХОБЛ.
2010

Деформирующий остеоартроз (ДОА) в настоящее время является наиболее распространенным дегенеративно-дистрофическим заболеванием суставов, которым страдают не менее 20% населения земного шара.
2010

Целью работы явилась оценка анальгетической эффективности препарата Кетанов (кеторолак трометамин), у хирургических больных в послеоперационном периоде и возможности уменьшения использования наркотических анальгетиков.
2010

Для более объективного подтверждения мембранно-стабилизирующего влияния карбамезапина и ламиктала нами оценивались перекисная и механическая стойкости эритроцитов у больных эпилепсией
2010

Нами было проведено клинико-нейропсихологическое обследование 250 больных с ХИСФ (работающих в фосфорном производстве Каратау-Жамбылской биогеохимической провинции)
2010


C использованием разработанных алгоритмов и моделей был произведен анализ ситуации в системе здравоохранения биогеохимической провинции. Рассчитаны интегрированные показатели здоровья
2010

Специфические особенности Каратау-Жамбылской биогеохимической провинции связаны с производством фосфорных минеральных удобрений.
2010

Optimization plan forage production in MATLAB

The article deals with the solution of the problem of forage production on the basis of linear programming and its implementation in MATLAB environment. Compiled economic and mathematical model of the problem of forage production. Matrix notation of a model of this problem is presented in Excel. With the help of special functions of the onboard optimization package in MATLAB, we solve the problem of forage production and to analyze the main results of the decision. 

Introduction

Many complex production and economic problems must be solved with the use of mathematical optimization techniques. One of such problems is the problem of forage production optimization.

Intrafarm plans for forage production should have a scientific basis, as the steady growth of animal production is provided by the strengthening of animal products. These issues can be successfully resolved with the use of both economic and mathematical modeling and specialized software applications.

Forage production is an important link between the crop production and animal husbandry on which condition the security of the population with animal products depends.

The problem of optimization of forage production is formulated as follows: to determine the optimal composition and structure of crops, providing a predetermined volume of animal products production and the implementation of zootechnical requirements for the structure of forage balance.

Optimization problems, optimal planning problems are associated with the finding of the optimum predetermined objective function (linear form) in the presence of restrictions in the form of linear equations and linear inequalities that relates to linear programming problems.

The essence of the linear programming is to find the points of the highest or lowest values of function at a certain set of  restrictions  on the  arguments  which  form a  system of  restrictions,  which  usually has an infinite number of solutions. Each set of variables (arguments to the function F), which satisfy the system of restrictions, is  called the  plan  of  a  valid linear programming problem.  Function  F,  which  maximum or minimum is determined, is called the objective function. Acceptable plan, on which the maximum or minimum of the function F is reached, is call an optimal plan of objectives.

The system of restrictions, which determines the set of plans, is dictated by the conditions of production. The objective of the linear programming (OLP) is the choice of the most favorable (optimal) plan out of the set of feasible plans.

In order to solve optimization problems on the basis of economic and mathematical modeling, popular software packages, PLP88, «Finding solutions» in MS Excel were used.

Many complex economic problems, such as: forecasting of temporal trends, dynamic classification, analysis and finding of anomalies in the behavior of economic entities in time, nonlinear programming, etc., cannot be realized in Excel, because of its limited capacity.

To solve such problems, it was decided to use the more modern advanced mathematical packages: Mathematica, MatCAD, Maple, Matlab, Neural networks, and so on.

For the solution of this problem, it is convenient to use the mathematical package MATLAB, which also provides the possibility of relation with a spreadsheet [1, 2] in addition to problem solving.

MATLAB (short from English. «Matrix Laboratory», in Russian language is pronounced as Matlab) — a software package for solving of technical computing and programming language used in this package. MATLAB is used by more than one million engineers and scientists, it works on the most modern operating systems, including Linux, Mac OS, Solaris (since version R2010b support for Solaris discontinued), and Microsoft Windows.

MATLAB is one of the oldest, well-developed and time proved system of automation of mathematical calculations, based on the extended presentation and use of matrix operations. This is reflected in the title of the system — MATrix LABoratory, i.e. matrix laboratory. However, the syntax of the programming language is thought so thoroughly that this orientation is almost not felt by those users who are not directly interested in the matrix calculation.

The structure of MATLAB software environment includes a communication interface (Excel Link), which provides the ability to exchange data between MATLAB workspaces and MS Excel. It allows you to read the necessary numerical and textual information to maintain the results of calculations in spreadsheets in the traditional form.

The modeling process can be divided into several stages: 1) formulation of the problem, definition of the object and purposes of the study, criteria (signs) of the study and its management; 2) selection of the mathematical model type; preparation of initial information; definition of methods of problem solution;

  • numerical solution and analysis of

For drawing up the task on optimizing the structure of forage production, the following initial information (depending on the goal, some details may be omitted) is used [3]: — Agricultural land (cultivated field, natural grasslands and pastures, hayfields and  cultivates grassland);

  • A list of crops that can be cultivated in the enterprise, their productivity;
  • The volume of sideline products of commercial crop production;
  • The nutrient content (forage units and digestible protein) per unit of forage (1 hectare or 1 c);
  • Production resources, norms of resource costs per 1 hectare of crops for the production of 1 quintal or 1 head of cattle;
  • Material and financial costs of 1 hectare of each type of feed;
  • The cost of 1 quintal of crop sideline products of commercial crop production;
  • The cost of the purchased forage;
  • The total amount of fixed costs on animal production;
  • Variable costs without the cost of forage) 1 c of animal products;
  • Productivity of agricultural animals;
  • The cost of forage units and digestible protein per 1 c (or 1 head) of animal products;
  • The cost structure of forage for animal production;
  • Products’ selling

The aim is to determine a structure of forage crops and grain forage crops as well as the number of other types of forage, which will provide animal breeding with the necessary forage at the lowest cost to its production.

Materials and methods of research

Drawing up the mathematical model. Variable:

X1 — the area of barley, hectare; X2 — the area of oats, hectare; X3 — the area of maize for silage, hectare; X4 — the area of annual grasses for hay, hectare; X5 — the area of annual grasses in the hay, hectare; X6 — the area of annual grasses in the green mass, hectare; X7 — haymaking area, ha; X8 — the area of pasture for grazing, hectare; X9 — the amount of grain wastages of wheat used for feed, hundredweight; X10 — the amount of grain wastages of barley used for feed, hundredweight; X11 — the amount of wheat straw used to feed, hundredweight; X12 — the amount of barley straw used as feed, hundredweight; X13 — the amount of oat straw used as feed, hundredweight; X14  — the volume of milk to feed, hundredweight; X15 — the amount of skimmed milk, hundredweight; X16 — the total production of fodder units, hundredweight; X17 — the total production of digestible protein, hundredweight; X18 — the number of cows; X19 — livestock of young cattle; X20 — the number of horses; X21 — the total amount of the produced milk, hundredweight; X22 — the total amount of weight gain in cattle, hundredweight.

Limitations of the model:

  1. The use of cultivated lands: х1 + х2 + х3 + х4 + х5 + х6 £ 3230
  2. The use of hayfields: х7 £ 810
  3. The use of pastures: х8 £ 4800
  4. The use of wheat grain wastages: х9 £ 5400
  5. The use of barley grain wastages: х10 £ 0,78х1
  6. The use of wheat straw: х11 £ 7280
  7. The use of barley straw: х12 £ 6,8х1
  8. The use of oat wheat straw: х13 £ 6,66х2
  1. The value of the variable Х16, the total amount of the produced fodder units: 12,3х1+10,6х2+18,7х3+3,7х4+12х5+8,4х6+1,7х7+3,2х8+0,9х9+0,96х10++0,22х11+0,31х12+0,34х13+0,32х14+0,13х15  = х16;
  1. The value of the variable х17, total production of digestible protein:

0,9х1+0,9х2+1,7х3+0,37х4+1,5х5+0,92х6+0,2х7+0,35х8++0,085х9+0,084х10+0,013х11+0,017х12+0,009х13+0,033х14+0,034х15  = х17

  1. Balance of production and use of feed units:х16  ³ 41,6x18+26,6х19+38х20
  1. The balance of digestible protein: х17 ³ 4,16х18+2,71х19+3,53х20
  2. Balance of the concentrated forage:12,3х1+10,6х2+0,9х9+0,96х10 ³ 9,568х18+6,783х19+11,4х20
  1. Balance of hay: 3,7х4+1,7х7 ³ 5,408x18+3,458х19+10,64х20 15. Balance of silage: 12х5 ³ 4,16x18+1,995,0х19+1,9х20
  2. Balance of straw: 0,22х11+0,31х12+0,34х13 ³ 1,248х18+0,931х19 17. Balance for silage: 18,7х3 ³ 9,152х18+2,66х19+2,66х20
  3. The balance of the herbage: 8,4х6+3,2х8 ³ 12,064х18+9,709х19+11,4х20
  4. The balance of feed milk : 0,32х14 ³ 0,798х19
  5. The balance of the use of skimmed milk: 0,13х15 ³ 0,266х19
  6. The relationship between the number of cows and milk production31,9х18  = х21
  1. The relationship between the livestock of young cattle and weight gain: 1,97х19 = х22
  2. The total number of cattle: 18+х19 = 1620
  3. The structure of the cattle: х18 ³ 0,35(х18+х19) или 0,65х18 – 0,35х19 ³ 0
  4. The number of horses: х20 = 30
  5. The ratio of fodder grain sowing:х2 ³ 0,1(х1+х2) or -0,1х1 + 0,9х2 ³  0

The objective function:

Z = 4444x1 + 3985,6x2 + 7220,7x3 + 4861,5x4 + 8820x5 + 2420x6 + 500x7 + 320x9 +

+ 320х10 + 60x11 + 60x12 + 60х13 + 1165х14 + 70х15  ® Min

The considered problem of the linear programming with linear constraints implement in MATLAB using the linprog Optimization Toolbox  package [4, 5].

Linprog function solves the problem of linear programming in MATLAB described as: f T · x → inf,

A · x ≥ b,                                                                                                                                      (1)

Aeq · x = beq, lb ≤ x ≤ ub

where f, x, b, beq, lb, and ub are vectors, A and Aeq are matrices, ie: inf — minimum of a function;

f — the vector of coefficients of the objective function; A — matrix of restriction inequalities;

b — vector of the right parts of restriction inequalities; Aeq — matrix of restriction equalities;

beq — vector of the right parts of restriction equalities; lb — vector limiting the plan x below;

ub — the vector limiting the plan x above.

At the output , function linprog allows optimal plan x of the task (1), and the extreme value fval of the objective function f.

Before solving the task in MATLAB. it is necessary to lead the having restrictions inequalities of Ax≤b and Ax≥b to one type of restrictions, in our case to the restrictions inequalities Ax≥b.

We will not put the initial data directly into MATLAB, and we will use the Excel file where they are stored in tabular form, i.e. are matrices and vectors (Figure 1). Access from the MATLAB to the initial data in spreadsheets MS Excel will provide the communication interface (Excel Link).

 Initial data of the task in MS Excel    

Figure 1. Initial data of the task in MS Excel 

The program (m-file) realizing the solution of the task in Matlab is described as follows (figure 2): clear all close all clc format bank format compact 

C=xlsread('optimkorm','kanon','c30:x30'); % read out the value of the objective function of the file Excel "optimkorm", sheet "kanon"

D=xlsread('optimkorm','kanon','c4:x23'); % read out the values of the left part of restrictions inequalities B=xlsread('optimkorm','kanon','aa4:aa23'); % read out values of the right part of restrictions inequalities Aeq=xlsread('optimkorm','kanon','c24:x29'); % read out values of the left part of restrictions equalities beq=xlsread('optimkorm','kanon','aa24:aa29');% read out values of the right part of restrictions equalities lb=zeros(22,1); % non-negativity condition

f=C; A=-D;

b=-B; % inequalities of Dx≥B are given to a form −Dx ≤−B options=optimset('LargeScale','off'); [x,fval,exitflag,output,lambda]=linprog(f,A,b,Aeq,beq,lb,[]); x

fval exitflag

output.iterations output.algorithm 

lambda=structfun(@(t)(t.'),lambda,'UniformOutput',false);  %  lambda  contents  for  the  best  display on the console screen are transposed lambda.ineqlin=lambda.ineqlin';% transposition of the vector dual ratings lambda.ineqlin % the output vector dual grade restrictions inequalities 

lambda.eqlin=lambda.eqlin';% transposition of the vector dual ratings lambda.eqlin % the output vector dual grade restrictions equalities L=xlsread('optimkorm','kanon','c4:x29'); % matrix from all values of the left part of restrictions M=L*x; % the matrix 'L' is multiplied by a vector column 'x' x=x';

xlswrite('optimkorm',x,'kanon','c3:x3'); % output the results of variable values

% in the optimkorm.xls file, on the sheet 'korm' in cells of 'c3:x3'

xlswrite ('optimkorm', fval, 'kanon', 'y30'); % output results of value of criterion function

%  file optimkorm.xls, to a sheet 'korm' in cell 'x30'

xlswrite ('optimkorm', M, 'kanon', 'y4'); %The results of the objective functionв

% % into the optimkorm.xls file, on the sheet 'korm' into a cell of 'x30' 

xlswrite('optimkorm',lambda.ineqlin,'kanon','ac4'); % output dual estimates at restrictions inequalities xlswrite('optimkorm',lambda.eqlin,'kanon','ac24'); % output dual estimates at restrictions equalities

xlswrite('optimkorm',lambda.upper,'kanon','c32'); % output xlswrite('optimkorm',lambda.lower,'kanon','c33'); % output

 The implementation of tasks in Matlab

Figure 2. The implementation of tasks in Matlab 

 

Discussion of the obtained data and conclusion

Command linprog performs various tasks depending on the included options.

In our case, the command [x, fval, exitflag, output, lambda] = is used by linprog (...), returning  structural

lambda, which fields include Lagrange's multipliers as the solution from x.

Exitflag value equal to 1 testifies that the solution of task is found. By means of the input parameter of options, the algorithm of the solution of task is established. In our case, the algorithm of the internal point (interior-point) was used by default.

Output parameter contains information on the process optimization, in particular, the number of iterations and the algorithm to be used.

Finally, the output parameter lambda contained solution to the dual problems of the linear programming. The parameter lambda consists of four arrays: lambda.ineqlin, lambda.eqlin, lambda.upper, lambda.lower.

In these arrays, there are dual variables attributed to the restrictions inequalities, restrictions equalities, restrictions on the plan  above and below respectively.

It is easy to check that the received plan of the dual task, meets conditions of the complementarity   and a ratio of the  duality of f (x *) = 23207718.18 = g (u *).

Commands xlswrite used in mfiles output the solution of the task to the designated cells of the used Excel file (figure 3). 

  Excel file with the results of the task solution which are automatically entered from Matlab

Figure 3. Excel file with the results of the task solution which are automatically entered from Matlab 

MATLAB libraries differ in the high speed of numerical calculations. However matrixes are widely applied not only in such mathematical calculations as the solution of problems of linear algebra and mathematical modeling, shortchanging of static and dynamic systems and objects. They are a basis of automatic drawing up and the solution of the equations of a condition of dynamic objects and systems. Universality of the device of matrix calculation considerably increases interest in the MATLAB system which incorporated the best achievements in the field of the fast solution of matrix tasks. 

 

References

  1. Dyaconov V.P., Kruglov V.V. Mathematical packages expansion of MATLAB: A special handbook, Peter, 2001, 480
  2. Kochegurova A. Features of MATLAB to solve problems of computational mathematics: Tutorial, Tomsk: Tomsk Polytechnic University, 2013, 110 p.
  3. Mathematical modeling of economic processes in agriculture, edit. A.M.Gataulin, Moscow: Agropromizdat,
  4. Vasіlyuk , Ostanin A. Sharing Excel and Matlab to solve financial problems, Politehnika, Beloctotskaya, Institute of Informatics, [ER]. Access mode: http://www.rusnauka.com/34_NOBG_2008/Economics.
  5. Sergeev A.N., Solovуоvа N.A., Cherneutsanu E.K. Solving linear programming in MATLAB, February 12, 2011, [ER]. Access mode: http://www.twirpx.com/file/962171/.

Разделы знаний

International relations

International relations

Law

Philology

Philology is the study of language in oral and written historical sources; it is the intersection between textual criticism, literary criticism, history, and linguistics.[

Technical science

Technical science