<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>On Solving Unconditional Optimization Problems in the Wolfram Mathematica System*</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Smolensk State University</institution>
          ,
          <addr-line>Smolensk</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
      </contrib-group>
      <fpage>0000</fpage>
      <lpage>0003</lpage>
      <abstract>
        <p>The article is devoted to the method of solving problems of unconditional optimization in the Wolfram Mathematica system, which can be used when conducting classes in theoretical and applied disciplines in technical universities. Algorithms for solving mathematical optimization problems are very complex. The use of electronic computing technology makes it possible to implement these algorithms but often imposes very high requirements on the competence of the person who wants to implement these algorithms. The systems of computer mathematics that have appeared in recent decades allow us to solve this problem. They have an interface that allows a specialist in any application field to solve these problems without resorting to programming in the classical sense of the word. One such system is the Wolfram Mathematica system.</p>
      </abstract>
      <kwd-group>
        <kwd>Wolfram Mathematica System</kwd>
        <kwd>Problems of Unconditional Optimization</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        The simplest example of an optimization problem is the unconditional optimization
problem. In this case, we look for the largest or smallest value of the function and the
point at which this value is reached. The need to solve such problems often arises when
solving a variety of technical tasks [
        <xref ref-type="bibr" rid="ref2 ref3">2,3</xref>
        ]. Interest in algorithms for solving optimization
problems continues [
        <xref ref-type="bibr" rid="ref10 ref4 ref5 ref6 ref7 ref8 ref9">4-10</xref>
        ]. Computer mathematics systems in this case, as in other
cases, allow you to focus on the mathematical model, and its implementation is carried
out through the system.
      </p>
      <p>The purpose of this article is to study the capabilities of the Wolfram Mathematica
system for solving unconditional optimization problems.</p>
      <p>The solution of such tasks can be carried out by the methods of differential calculus.
The Wolfram Mathematica system allows you to solve such problems, including when
the parameters are set as letter coefficients.
*</p>
      <p>Copyright 2021 for this paper by its authors. Use permitted under Creative Commons License
Attribution 4.0 International (CC BY 4.0).</p>
      <p>Solving Inventory Management Problems in the Mathematica
System.</p>
      <p>
        Consider the problem of managing a single-product stock [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Even if there is no
shortage, the stock is replenished at a time. Total expenses per unit of time consist of specific
operating and non-production expenses. For simplicity, assume that operating costs are
by definition proportional to the level of average inventory
      </p>
      <p>where h is the operating costs per unit of time associated with storing a unit of
inventory, and non – production costs are inversely proportional to the length of the order
cycle
where k is the total non – production costs. Then the specific total expenses are equal
zexpl 
hx
2 ,
zn 
kd
x ,
zA 
hx
2

kd
x
z  f  x  min
u[x]=(h*x)/2+(k*d)/x
u1[x]=D[u[x],x]</p>
      <p>h/2–(d k)/x^2
where d is the intensity of demand.</p>
      <p>The optimal stock level is found from the condition
Finding the derivative of the function zA(x) using the Mathematica system</p>
    </sec>
    <sec id="sec-2">
      <title>Receive result Equate the derivative to zero and solve the resulting equation with respect to x</title>
      <p>Solve[u1[x]==0,x]
x </p>
      <p>Now let's assume that the stock is replenished by output with an intensity of
production per unit of time r that exceeds the intensity of demand d(r&gt;d). then the specific
total costs are expressed by the formula.</p>
      <p>Find the derivative of the function zB(x) using the Mathematica system.
zB 
hx 1  d 
 r  
2
kd
x</p>
      <p>u3[x]=D[u2[x],x]
1/2 h (1–d/r) – (d k)/x^2</p>
      <p>Solve[u3[x]==0,x]</p>
    </sec>
    <sec id="sec-3">
      <title>Receive result</title>
      <p>Equate the derivative to zero and solve the resulting equation with respect to x</p>
      <p>Let's assume that the required inventory level is no longer available and the
inventory is replenished at the same time. In this case, the total costs additionally include the
costs zd due to the lack of the required inventory level, and the unit total costs are
determined by the expression
zB 
h  x  v2  bv2
2x

kd
x
where v is the value of the deficit, and b is the specific losses from the deficit per
unit of time.</p>
      <p>We find partial derivatives of function z(x,v) with respect to x and v using the
Wolfram Mathematica system.</p>
      <p>gg[x,v]=(h*(x–v)^2+b*v^2)/(2*x)+(k*d)/x
gg1[x,v]=D[gg[x,v],x]</p>
      <p>We equate the obtained derivatives to zero and solve the resulting system of
equations for x and v</p>
      <p>Solve[{gg1[x,v]==0,gg2[x,v]==0},{x,v}]
Let's simplify the result and get the answer.</p>
      <sec id="sec-3-1">
        <title>FullSimplify[%]</title>
        <p>
          {{x–((Sqrt[
          <xref ref-type="bibr" rid="ref2">2</xref>
          ] Sqrt[d] Sqrt[b (b+h)] Sqrt[k])/(b Sqrt[h])),v–((Sqrt[
          <xref ref-type="bibr" rid="ref2">2</xref>
          ] Sqrt[d]
Sqrt[h] Sqrt[k])/Sqrt[b (b+h)])},{x (Sqrt[
          <xref ref-type="bibr" rid="ref2">2</xref>
          ] Sqrt[d] Sqrt[b (b+h)] Sqrt[k])/(b
        </p>
        <p>
          Sqrt[h]),v (Sqrt[
          <xref ref-type="bibr" rid="ref2">2</xref>
          ] Sqrt[d] Sqrt[h] Sqrt[k])/Sqrt[b (b+h)]}}
Choosing from the two obtained values x and v positive, we get
Now let's consider the case of a deficit with a uniform replenishment of the stock.
In this case, the unit total expenses are defined by the expression
x 
2dkb b  h
b h
, v 
        </p>
        <p>2kdh
b b  h</p>
        <p>We find partial derivatives of function z(x,v) for x and v using the Wolfram
Mathematica system.</p>
        <p>f[x,v]=(h*(x*(1–d/r)–v)^2+b*v^2)/(2*x*(1–d/r))+k*d/x
ff1[x,v]=D[f[x,v],x]
ff2[x,v]=D[f[x,v],v]</p>
        <p>We equate the obtained derivatives to zero and solve the resulting system of
equations for x and v</p>
        <p>Solve[{ff1[x,v]==0,ff2[x,v]==0},{x,v}].</p>
        <p>Let's simplify the result and get the answer.</p>
      </sec>
      <sec id="sec-3-2">
        <title>FullSimplify[%]</title>
        <p>
          {{x–((I Sqrt[
          <xref ref-type="bibr" rid="ref2">2</xref>
          ] Sqrt[d] Sqrt[b+h] Sqrt[k] Sqrt[r])/Sqrt[b h (d–r)]),v (I Sqrt[
          <xref ref-type="bibr" rid="ref2">2</xref>
          ]
        </p>
        <p>
          Sqrt[d] Sqrt[k] Sqrt[b h (d–r)])/(b Sqrt[b+h] Sqrt[r])},{x (I Sqrt[
          <xref ref-type="bibr" rid="ref2">2</xref>
          ] Sqrt[d]
Sqrt[b+h] Sqrt[k] Sqrt[r])/Sqrt[b h (d–r)],v–((I Sqrt[
          <xref ref-type="bibr" rid="ref2">2</xref>
          ] Sqrt[d] Sqrt[k] Sqrt[b h
(d–r)])/(b Sqrt[b+h] Sqrt[r]))}}
        </p>
        <p>The resulting result may be somewhat confusing, since the resulting expressions
contain an imaginary unit (I). However, remembering that by condition r&gt;d , hence
Multiplying by i, we get</p>
        <p>d  r  i r  d .
x 
2dkr b  h
bh r  d 
, v 
2dkh r  d 
r b  h</p>
        <p>These examples illustrate the ability of the Wolfram Mathematica system to work
with expressions in a General way. The latter case also shows that the results obtained
with its help may require additional study and analysis.
2</p>
        <p>New Tools for Solving Optimization Problems in the Latest
Versions of Mathematica.</p>
        <p>
          The Mathematica system allows you to solve such problems directly using built-in
methods. The main methods for solving such problems using Wolfram Mathematica
are widely known and discussed, for example, in [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]. However, the system is evo lving
and new features are emerging. For example, in version 11 of the system, the
BayesianMinimization command was added. This command makes it possible to solve several
new minimization problems along with well-known ones.
        </p>
        <p>You can use this command to solve the usual problem of minimizing a function on
an interval.</p>
        <p>bo=BayesianMinimization[(#–2)^2+ 1&amp;,Interval[{0,7}]]
In this example, we minimize the function</p>
        <p>f  x   x  22 1
on the interval [0;7]. Receive result</p>
        <p>BayesianMinimizationObject[Minimum configuration: 2.03
Minimum value: 1.]
Let's present the results of calculations in a more convenient form
bo["MinimumConfiguration"]
2.03379
bo["MinimumValue"]
1.01162</p>
        <p>Let's build graphs of the simulated and modeling functions (see Fig. 1).
function
model</p>
        <p>Here we see that it is better to use the usual Minimize function to solve this problem.
However, the BayesianMinimization team has features that previously existing Teams
did not have. We can look at the set of values that were used to calculate the minimum
bo["EvaluationHistory"]
Configuration Value
6.30544 19.5368
3.91381 4.66267
3.13817 2.29542
1.07336 1.85866
2.16175 1.02616
1.86308 1.01875
1.88728 1.01271
0.0977517 4.61855
6.82761 24.3058
3.04529 2.09263
2.05689 1.00324
4.27194 6.16173
4.80517 8.86897
3.09127 2.19086
0.924357 2.15701
We can also perform function minimization on a discrete set.</p>
        <p>bo=BayesianMinimization[(#^2-5*#+2)&amp;,{5.7,1.1,3.4,6.8,2.3,1.2}]
bo["MinimumConfiguration"]
2.3
bo["MinimumValue"]
–4.21
We can minimize the function on a set constructed using a random number generator
bo1=BayesianMinimization[ (#^2-5*#+4)&amp;,RandomReal[{0,10}]&amp;]
bo1["MinimumConfiguration"]
2.54493
bo1["MinimumValue"]
–2.24796</p>
        <p>All these new features allow us to expand the range of problems that can be
considered with students when studying problems whose mathematical models are reduced to
problems of unconditional optimization.
4</p>
        <p>Conclusion.</p>
        <p>Along with the examples discussed in this article, the system allows you to solve a wide
range of different optimization problems: linear programming problems (in particular,
the transport problem), the assignment problem, and dynamic programming problems.
Methods for solving multi-criteria optimization problems using the Mathematica
system are developed.</p>
        <p>The Mathematica system also allows you to solve a large number of problems related
to the most diverse areas of mathematics and applied disciplines. In the latest versions
of the system, it includes some artificial intelligence algorithms (in particular, image
recognition). All this makes it an indispensable tool for teaching students of
mathematical and engineering specialties, as well as for conducting scientific research.</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Kristalinsky</surname>
            ,
            <given-names>V. R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Cherny</surname>
            ,
            <given-names>S. N.</given-names>
          </string-name>
          <article-title>Solving Problems of Dynamic Programming in the Wolfram Mathematica System</article-title>
          .
          <source>International journal of open information technologies</source>
          . Vol.
          <volume>7</volume>
          . - no.
          <issue>2</issue>
          . (
          <year>2019</year>
          ). (In Russian)
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Kristalinsky</surname>
            ,
            <given-names>V. R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kristalinsky</surname>
            ,
            <given-names>R. E.</given-names>
          </string-name>
          :
          <article-title>Solution of the Dirichlet Problem for Multi-Connected Domains</article-title>
          .
          <article-title>Modern Information Technologies and IT education</article-title>
          . pp.
          <fpage>220</fpage>
          -
          <lpage>226</lpage>
          . (
          <year>2019</year>
          ). (In Russian)
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Kristalinsky</surname>
            ,
            <given-names>V. R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kristalinsky</surname>
          </string-name>
          , R. E.:
          <article-title>On the Use of the Wolfram Mathematica System in Statistical Data Analysis</article-title>
          .
          <source>Distance Educational Technologies</source>
          . pp.
          <fpage>58</fpage>
          -
          <lpage>61</lpage>
          . (
          <year>2019</year>
          ). (In Russian)
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Rao</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          <article-title>Jaya: A Simple and New Optimization Algorithm for Solving Constrained and Unconstrained Optimization Problems</article-title>
          .
          <source>International Journal of Industrial</source>
          Engineering Computations. V.
          <volume>7</volume>
          . №. 1. PP.
          <volume>19</volume>
          -
          <fpage>34</fpage>
          . DOI:
          <volume>10</volume>
          .5267/j.ijiec.
          <year>2015</year>
          .
          <volume>8</volume>
          .
          <issue>004</issue>
          (
          <year>2016</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Tejani</surname>
            ,
            <given-names>G. G.</given-names>
          </string-name>
          et al.:
          <article-title>An Improved Heat Transfer Search Algorithm for Unconstrained Optimization Problems</article-title>
          .
          <source>Journal of Computational Design and Engineering</source>
          . V.
          <volume>6</volume>
          . №. 1. PP.
          <volume>13</volume>
          -
          <fpage>32</fpage>
          . DOI:
          <volume>10</volume>
          .1016/j.jcde.
          <year>2018</year>
          .
          <volume>04</volume>
          .003 (
          <year>2019</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Yuan</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hu</surname>
            ,
            <given-names>W.:</given-names>
          </string-name>
          <article-title>A Conjugate Gradient Algorithm for Large-Scale Unconstrained Optimization Problems and Nonlinear Equations</article-title>
          .
          <source>Journal of Inequalities and Applications</source>
          . V.
          <year>2018</year>
          . №. 1. PP.
          <volume>113</volume>
          . DOI:
          <volume>10</volume>
          .1186/s13660-018-1703-1. (
          <year>2018</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Yuan</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wang</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sheng</surname>
            ,
            <given-names>Z.</given-names>
          </string-name>
          :
          <article-title>The Projection Technique for Two Open Problems of Unconstrained Optimization Problems</article-title>
          .
          <source>Journal of Optimization Theory and Applications</source>
          . V.
          <volume>186</volume>
          . №. 2. PP.
          <volume>590</volume>
          -
          <fpage>619</fpage>
          . DOI:
          <volume>10</volume>
          .1007/s10957-020-01710-0. (
          <year>2020</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Zang</surname>
            <given-names>W.</given-names>
          </string-name>
          et al.
          <article-title>A genetic algorithm using triplet nucleotide encoding and DNA reproduction operations for unconstrained optimization problems</article-title>
          . Algorithms. V.
          <volume>10</volume>
          . №. 3. PP.
          <volume>76</volume>
          . DOI:
          <volume>10</volume>
          .3390/a10030076. (
          <year>2017</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Ghazali</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          et al.:
          <article-title>Newton-SOR Iteration for Solving Large-Scale Unconstrained Optimization Problems with an Arrowhead Hessian Matrices</article-title>
          .
          <source>Journal of Physics: Conference Series. IOP Publishing</source>
          . V.
          <volume>1358</volume>
          . №. 1. PP.
          <volume>012054</volume>
          . (
          <year>2019</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Ghazali</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          et al.:
          <article-title>Newton-SOR Iteration for Solving Large-Scale Unconstrained Optimization Problems with an Arrowhead Hessian Matrices</article-title>
          .
          <source>Journal of Physics: Conference Series. IOP Publishing</source>
          ,
          <year>2019</year>
          . V.
          <volume>1358</volume>
          . №. 1. PP.
          <volume>012054</volume>
          . DOI:
          <volume>10</volume>
          .1088/
          <fpage>1742</fpage>
          -6596/1358/1/012054
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>