You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<spanid="_CPPv3N5pagmo3psoE"></span><spanid="_CPPv2N5pagmo3psoE"></span><spanid="pagmo::pso"></span><spanclass="target" id="classpagmo_1_1pso"></span><spanclass="k"><spanclass="pre">class</span></span><spanclass="w"></span><spanclass="sig-name descname"><spanclass="n"><spanclass="pre">pso</span></span></span><aclass="headerlink" href="#_CPPv4N5pagmo3psoE" title="Permalink to this definition">#</a><br/></dt>
<p>Particle swarm optimization (PSO) is a population based algorithm inspired by the foraging behaviour of swarms. In PSO each point has memory of the position where it achieved the best performance <spanclass="math notranslate nohighlight">\(\mathbf x^l_i\)</span> (local memory) and of the best decision vector <spanclass="math notranslate nohighlight">\( \mathbf x^g \)</span> in a certain neighbourhood, and uses this information to update its position using the equations (constriction coefficient): <divclass="math notranslate nohighlight">
423
+
<p>Particle swarm optimization (PSO) is a population based algorithm inspired by the foraging behaviour of swarms. In PSO each point has memory of the position where it achieved the best performance <spanclass="math notranslate nohighlight">\(\mathbf x^l_i\)</span> (local memory) and of the best decision vector <spanclass="math notranslate nohighlight">\( \mathbf x^g \)</span> in a certain neighbourhood, and uses this information to update its position using the equations (constriction coefficient): <divclass="math notranslate nohighlight">
Copy file name to clipboardExpand all lines: docs/cpp/problem.html
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -431,7 +431,7 @@ <h1>Problem<a class="headerlink" href="#problem" title="Permalink to this headli
431
431
<spanid="_CPPv3N5pagmo7problemE"></span><spanid="_CPPv2N5pagmo7problemE"></span><spanid="pagmo::problem"></span><spanclass="target" id="classpagmo_1_1problem"></span><spanclass="k"><spanclass="pre">class</span></span><spanclass="w"></span><spanclass="sig-name descname"><spanclass="n"><spanclass="pre">problem</span></span></span><aclass="headerlink" href="#_CPPv4N5pagmo7problemE" title="Permalink to this definition">#</a><br/></dt>
<p>This class represents a generic <em>mathematical programming</em> or <em>evolutionary optimization</em> problem in the form: <divclass="math notranslate nohighlight">
434
+
<p>This class represents a generic <em>mathematical programming</em> or <em>evolutionary optimization</em> problem in the form: <divclass="math notranslate nohighlight">
435
435
\[\begin{split}
436
436
\begin{array}{rl}
437
437
\mbox{find:} & \mathbf {lb} \le \mathbf x \le \mathbf{ub}\\
@@ -441,10 +441,10 @@ <h1>Problem<a class="headerlink" href="#problem" title="Permalink to this headli
441
441
\end{array}
442
442
\end{split}\]</div>
443
443
</p>
444
-
<p>where <spanclass="math notranslate nohighlight">\(\mathbf x \in \mathbb R^{n_{cx}} \times \mathbb Z^{n_{ix}}\)</span> is called <em>decision vector</em> or <em>chromosome</em>, and is made of <spanclass="math notranslate nohighlight">\(n_{cx}\)</span> real numbers and <spanclass="math notranslate nohighlight">\(n_{ix}\)</span> integers (all represented as doubles). The total problem dimension is then indicated with <spanclass="math notranslate nohighlight">\(n_x = n_{cx} + n_{ix}\)</span>. <spanclass="math notranslate nohighlight">\(\mathbf{lb}, \mathbf{ub} \in
445
-
\mathbb R^{n_{cx}} \times \mathbb Z^{n_{ix}}\)</span> are the <em>box-bounds</em>, <spanclass="math notranslate nohighlight">\( \mathbf f: \mathbb R^{n_{cx}} \times
\times \mathbb Z^{n_{ix}} \rightarrow \mathbb R^{n_{ec}}\)</span> are non linear <em>equality constraints</em>, and <spanclass="math notranslate nohighlight">\( \mathbf
444
+
<p>where <spanclass="math notranslate nohighlight">\(\mathbf x \in \mathbb R^{n_{cx}} \times \mathbb Z^{n_{ix}}\)</span> is called <em>decision vector</em> or <em>chromosome</em>, and is made of <spanclass="math notranslate nohighlight">\(n_{cx}\)</span> real numbers and <spanclass="math notranslate nohighlight">\(n_{ix}\)</span> integers (all represented as doubles). The total problem dimension is then indicated with <spanclass="math notranslate nohighlight">\(n_x = n_{cx} + n_{ix}\)</span>. <spanclass="math notranslate nohighlight">\(\mathbf{lb}, \mathbf{ub} \in
445
+
\mathbb R^{n_{cx}} \times \mathbb Z^{n_{ix}}\)</span> are the <em>box-bounds</em>, <spanclass="math notranslate nohighlight">\( \mathbf f: \mathbb R^{n_{cx}} \times
\times \mathbb Z^{n_{ix}} \rightarrow \mathbb R^{n_{ec}}\)</span> are non linear <em>equality constraints</em>, and <spanclass="math notranslate nohighlight">\( \mathbf
448
448
c_i: \mathbb R^{n_{cx}} \times \mathbb Z^{n_{ix}} \rightarrow \mathbb R^{n_{ic}}\)</span> are non linear <em>inequality constraints</em>. Note that the objectives and constraints may also depend from an added value <spanclass="math notranslate nohighlight">\(s\)</span> seeding the values of any number of stochastic variables. This allows also for stochastic programming tasks to be represented by this class. A tolerance is also considered for all constraints and set, by default, to zero. It can be modified via the <aclass="reference internal" href="#classpagmo_1_1problem_1ab1bbd8f6f4c119aef9e04fdfa499a33e"><spanclass="std std-ref">problem::set_c_tol()</span></a> method.</p>
449
449
<p>In order to define an optimization problem in pagmo, the user must first define a class (or a struct) whose methods describe the properties of the problem and allow to compute the objective function, the gradient, the constraints, etc. In pagmo, we refer to such a class as a <strong>user-defined problem</strong>, or UDP for short. Once defined and instantiated, a UDP can then be used to construct an instance of this class, <aclass="reference internal" href="#classpagmo_1_1problem"><spanclass="std std-ref">pagmo::problem</span></a>, which provides a generic interface to optimization problems.</p>
450
450
<p>Every UDP must implement at least the following two methods: <divclass="highlight-text notranslate"><divclass="highlight"><pre><span></span>vector_double fitness(const vector_double &) const;
Copy file name to clipboardExpand all lines: docs/cpp/problems/ackley.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -420,7 +420,7 @@ <h1>Ackley<a class="headerlink" href="#ackley" title="Permalink to this headline
420
420
<spanid="_CPPv3N5pagmo6ackleyE"></span><spanid="_CPPv2N5pagmo6ackleyE"></span><spanid="pagmo::ackley"></span><spanclass="target" id="structpagmo_1_1ackley"></span><spanclass="k"><spanclass="pre">struct</span></span><spanclass="w"></span><spanclass="sig-name descname"><spanclass="n"><spanclass="pre">ackley</span></span></span><aclass="headerlink" href="#_CPPv4N5pagmo6ackleyE" title="Permalink to this definition">#</a><br/></dt>
<p>This is a scalable box-constrained continuous single-objective problem. The objective function is the generalised n-dimensional Ackley function: <divclass="math notranslate nohighlight">
423
+
<p>This is a scalable box-constrained continuous single-objective problem. The objective function is the generalised n-dimensional Ackley function: <divclass="math notranslate nohighlight">
<p>In the case of <spanclass="math notranslate nohighlight">\(n\)</span> objectives, we indicate with: <spanclass="math notranslate nohighlight">\( \mathbf f(\mathbf x) = [f_1(\mathbf x), \ldots, f_n(\mathbf
431
-
x)] \)</span> the vector containing the original multiple objectives, with: <spanclass="math notranslate nohighlight">\( \boldsymbol \lambda = (\lambda_1, \ldots,
432
-
\lambda_n) \)</span> an <spanclass="math notranslate nohighlight">\(n\)</span>-dimensional weight vector and with: <spanclass="math notranslate nohighlight">\( \mathbf z^* = (z^*_1, \ldots, z^*_n) \)</span> an <spanclass="math notranslate nohighlight">\(n\)</span>-dimensional reference point. We also ussume <spanclass="math notranslate nohighlight">\(\lambda_i > 0, \forall i=1..n\)</span> and <spanclass="math notranslate nohighlight">\(\sum_i \lambda_i =
430
+
<p>In the case of <spanclass="math notranslate nohighlight">\(n\)</span> objectives, we indicate with: <spanclass="math notranslate nohighlight">\( \mathbf f(\mathbf x) = [f_1(\mathbf x), \ldots, f_n(\mathbf
431
+
x)] \)</span> the vector containing the original multiple objectives, with: <spanclass="math notranslate nohighlight">\( \boldsymbol \lambda = (\lambda_1, \ldots,
432
+
\lambda_n) \)</span> an <spanclass="math notranslate nohighlight">\(n\)</span>-dimensional weight vector and with: <spanclass="math notranslate nohighlight">\( \mathbf z^* = (z^*_1, \ldots, z^*_n) \)</span> an <spanclass="math notranslate nohighlight">\(n\)</span>-dimensional reference point. We also ussume <spanclass="math notranslate nohighlight">\(\lambda_i > 0, \forall i=1..n\)</span> and <spanclass="math notranslate nohighlight">\(\sum_i \lambda_i =
433
433
1\)</span>.</p>
434
434
<p>The decomposed problem is thus a single objective optimization problem having the following single objective, according to the decomposition method chosen:</p>
Copy file name to clipboardExpand all lines: docs/cpp/problems/griewank.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -420,7 +420,7 @@ <h1>Griewank<a class="headerlink" href="#griewank" title="Permalink to this head
420
420
<spanid="_CPPv3N5pagmo8griewankE"></span><spanid="_CPPv2N5pagmo8griewankE"></span><spanid="pagmo::griewank"></span><spanclass="target" id="structpagmo_1_1griewank"></span><spanclass="k"><spanclass="pre">struct</span></span><spanclass="w"></span><spanclass="sig-name descname"><spanclass="n"><spanclass="pre">griewank</span></span></span><aclass="headerlink" href="#_CPPv4N5pagmo8griewankE" title="Permalink to this definition">#</a><br/></dt>
<p>This is a scalable box-constrained continuous single-objective problem. The objective function is the generalised n-dimensional Griewank function: <divclass="math notranslate nohighlight">
423
+
<p>This is a scalable box-constrained continuous single-objective problem. The objective function is the generalised n-dimensional Griewank function: <divclass="math notranslate nohighlight">
<spanid="_CPPv3N5pagmo9inventoryE"></span><spanid="_CPPv2N5pagmo9inventoryE"></span><spanid="pagmo::inventory"></span><spanclass="target" id="classpagmo_1_1inventory"></span><spanclass="k"><spanclass="pre">class</span></span><spanclass="w"></span><spanclass="sig-name descname"><spanclass="n"><spanclass="pre">inventory</span></span></span><aclass="headerlink" href="#_CPPv4N5pagmo9inventoryE" title="Permalink to this definition">#</a><br/></dt>
421
421
<dd><p>Stochastic Programming Test Problem: An Inventory Model. </p>
<p>This problem is a generalization of the simple inventory problem so-called of the “news-vendor”, widely used to introduce the main tools and techniques of stochastic programming Assume you are a newsvendor and each week, for the next <spanclass="math notranslate nohighlight">\( N\)</span> weeks, you need to decide how many journals to order (indicated with the decision variable <spanclass="math notranslate nohighlight">\( x_i \)</span>). The weekly journal demand is unknown to you and is indicated with the variable <spanclass="math notranslate nohighlight">\(d_i\)</span>. The cost of ordering journals before the week starts is <spanclass="math notranslate nohighlight">\( c\)</span>, the cost of ordering journals during the week (in order to meet an unforeseen demand) is <spanclass="math notranslate nohighlight">\( b \)</span> and the cost of having to hold unsold journals is <spanclass="math notranslate nohighlight">\( h \)</span>. The inventory level of journals will be defined by the succession: <divclass="math notranslate nohighlight">
423
+
<p>This problem is a generalization of the simple inventory problem so-called of the “news-vendor”, widely used to introduce the main tools and techniques of stochastic programming Assume you are a newsvendor and each week, for the next <spanclass="math notranslate nohighlight">\( N\)</span> weeks, you need to decide how many journals to order (indicated with the decision variable <spanclass="math notranslate nohighlight">\( x_i \)</span>). The weekly journal demand is unknown to you and is indicated with the variable <spanclass="math notranslate nohighlight">\(d_i\)</span>. The cost of ordering journals before the week starts is <spanclass="math notranslate nohighlight">\( c\)</span>, the cost of ordering journals during the week (in order to meet an unforeseen demand) is <spanclass="math notranslate nohighlight">\( b \)</span> and the cost of having to hold unsold journals is <spanclass="math notranslate nohighlight">\( h \)</span>. The inventory level of journals will be defined by the succession: <divclass="math notranslate nohighlight">
424
424
\[
425
425
I_i = [I_{i-1} + x_i - d_i]_+, I_1 = 0
426
426
\]</div>
427
-
while the total cost of running the journal sales for <spanclass="math notranslate nohighlight">\(N\)</span> weeks will be: <divclass="math notranslate nohighlight">
427
+
while the total cost of running the journal sales for <spanclass="math notranslate nohighlight">\(N\)</span> weeks will be: <divclass="math notranslate nohighlight">
428
428
\[
429
429
J(\mathbf x, \mathbf d) = c \sum_{i=1}^N x_i+ b \sum_{i=1}^N [d_i - I_i - x_i]_+ + h \sum_{i=1}^N [I_i + x_i -
<spanid="_CPPv3N5pagmo15minlp_rastriginE"></span><spanid="_CPPv2N5pagmo15minlp_rastriginE"></span><spanid="pagmo::minlp_rastrigin"></span><spanclass="target" id="structpagmo_1_1minlp__rastrigin"></span><spanclass="k"><spanclass="pre">struct</span></span><spanclass="w"></span><spanclass="sig-name descname"><spanclass="n"><spanclass="pre">minlp_rastrigin</span></span></span><aclass="headerlink" href="#_CPPv4N5pagmo15minlp_rastriginE" title="Permalink to this definition">#</a><br/></dt>
421
421
<dd><p>A MINLP version of the Rastrigin problem. </p>
<p>This is a scalable, box-constrained, mixed integer nonlinear programmng (MINLP) problem. The objective function is the generalised n-dimensional Rastrigin function: <divclass="math notranslate nohighlight">
423
+
<p>This is a scalable, box-constrained, mixed integer nonlinear programmng (MINLP) problem. The objective function is the generalised n-dimensional Rastrigin function: <divclass="math notranslate nohighlight">
<p>where we constraint the last <spanclass="math notranslate nohighlight">\(m\)</span> components of the decision vector to be integers. The variables are box bounded as follows: <spanclass="math notranslate nohighlight">\(\quad x_i \in [-5.12,5.12], \forall i = 1 .. n-m\)</span>, <spanclass="math notranslate nohighlight">\(\quad x_i \in [-10,-5], \forall
428
+
<p>where we constraint the last <spanclass="math notranslate nohighlight">\(m\)</span> components of the decision vector to be integers. The variables are box bounded as follows: <spanclass="math notranslate nohighlight">\(\quad x_i \in [-5.12,5.12], \forall i = 1 .. n-m\)</span>, <spanclass="math notranslate nohighlight">\(\quad x_i \in [-10,-5], \forall
429
429
i = m+1 .. n\)</span></p>
430
-
<p>Gradients (dense) are also provided (also for the integer part) as: <divclass="math notranslate nohighlight">
430
+
<p>Gradients (dense) are also provided (also for the integer part) as: <divclass="math notranslate nohighlight">
0 commit comments