<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.0">Jekyll</generator><link href="https://www.wolfoptimization.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://www.wolfoptimization.com/" rel="alternate" type="text/html" /><updated>2021-09-22T06:06:35+00:00</updated><id>https://www.wolfoptimization.com/feed.xml</id><title type="html">Wolf Optimization</title><subtitle>Wolf Optimization develop a high-performance interior-point method implementation for solving conic programs, especially those that are large and sparse.
</subtitle><author><name>Wolf Optimization Pty Ltd</name></author><entry><title type="html">C Interface</title><link href="https://www.wolfoptimization.com/c-interface.html" rel="alternate" type="text/html" title="C Interface" /><published>2021-09-21T00:00:00+00:00</published><updated>2021-09-21T00:00:00+00:00</updated><id>https://www.wolfoptimization.com/c-interface</id><content type="html" xml:base="https://www.wolfoptimization.com/c-interface.html">&lt;h1 id=&quot;c-quick-start&quot;&gt;C quick start&lt;/h1&gt;
&lt;p&gt;The below solves the problem $\min. x_1, \textrm{subject to } x_3 = 1, x_1 \ge \sqrt{x_2^2 + x_3^2}$. This obviously has the optimal solution $x= (1, 0, 1)^T$.&lt;/p&gt;

&lt;p&gt;First we include the headers we need.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;#include &quot;wolf.h&quot;
#include &amp;lt;stdio.h&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Then we define the function to output the solver progress during the solution process:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;static int print_progress(integer iteration, double *dnfo)
{
	/* Output progress update. */
	printf(&quot;%3i %8.1e %8.1e %8.1e %8.1e %11.4e %11.4e %7.3f %8.1e %8.1e %7.1f\n&quot;, (int)iteration, dnfo[0], dnfo[1], dnfo[2], dnfo[3], dnfo[4], dnfo[5], dnfo[6], dnfo[7], dnfo[8], dnfo[9]);
	return 0;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Inside our main function we declare the problem struct and specify the number of primitive cones for each cone type:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;int main()
{
	/* Set up problem struct. */
	wolf_cos_t prob;
	prob.m = 1;
	prob.n = 3;
	prob.nF = 0;
	prob.nL = 0;
	prob.nQ = 1;
	prob.nR = 0;
	prob.nS = 0;
	prob.nP = 0;
	prob.nE = 0;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The actual problem is defined here, with $A=[0 0 1]$, $b=[1]$ and $c=[1 0 0]^T$, and the pointer structure for the second-order cone of size 3.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;	integer pQ[2] = { 0, 3 };
	integer pA[4] = { 0, 0, 0, 1 };
	integer iA[1] = { 0 };
	double xA[1] = { 1.0 };
	double b[1] = { 1.0 };
	double c[3] = { 1.0, 0.0, 0.0 };
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The unknown variables being optimized, $x$, $y$ and $s$ for the primal and dual problems are declared.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;	double x[3], y[1], s[3];
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Pointers to all of these arrays are then needed in the problem structure being passed to the solver.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;	prob.x = x;
	prob.y = y;
	prob.s = s;

	prob.pQ = pQ;
	prob.pA = pA;
	prob.iA = iA;
	prob.xA = xA;
	prob.b = b;
	prob.c = c;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Set the default parameters, modify the maximum number of iterations or other parameters as desired.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;	/* Set default parameters. */
	wolf_setpar(&amp;amp;prob);

	/* Modify default parameters. */
	prob.ipar[WOLF_COS_IS_MAXITER] = 99;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In preparation for calling the solver, we output a header for the callback function output.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;	/* Output progress header. */
	printf(&quot;\nWolf Conic Optimization Solver\n&quot;);
	printf(&quot; It    pinf     dinf     ginf      u       pobj        dobj      alpha    tau     kappa     time\n&quot;);
	printf(&quot;-------------------------------------------------------------------------------------------------\n&quot;);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We now call the solver and check for error messages upon return, displaying the error message if necessary.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;	/* Solve the problem. */
	wolf_cos(&amp;amp;prob, print_progress);

	/* Check for error and display message. */
	if (prob.error != 0)
		printf(&quot;*** %s ***\n&quot;, wolf_geterrormsg(prob.error));
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We can then display various solution information details, as required. Here we select a relevant subset for the problem at hand.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;	printf(&quot;\nSolution info:\n--------------\n&quot;);
	printf(&quot;Average objective:      %9.7f\n&quot;, 0.5*(prob.dnfo[0] + prob.dnfo[1]));
	printf(&quot;Iterations:             %d\n&quot;, prob.info[0]);
	printf(&quot;Primal infeasibility:  %8.1e\n&quot;, prob.dnfo[2]);
	printf(&quot;Dual infeasiblity:     %8.1e\n&quot;, prob.dnfo[3]);
	printf(&quot;Relative duality gap:  %8.1e\n&quot;, prob.dnfo[4]);

	printf(&quot;x = [ %9.7f %9.7f %9.7f ]\n&quot;, x[0], x[1], x[2]);
	printf(&quot;y = [ %9.7f ]\n&quot;, y[0]);
	printf(&quot;s = [ %9.7f %9.7f %9.7f ]\n&quot;, s[0], s[1], s[2]);

	printf(&quot;Second-order cones:    %10li\n&quot;, prob.info[5]);
	printf(&quot;Non-zeros in A:        %10li (originally %10li)\n&quot;, prob.info[7], prob.pA[prob.n]);
	printf(&quot;Non-zeros in M:        %10li\n&quot;, prob.info[8]);
	printf(&quot;Non-zeros in L:        %10li\n&quot;, prob.info[9]);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This gives the following output before and during the solver’s progress.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Wolf Conic Optimization Solver

 It    pinf     dinf     ginf      u       pobj        dobj      alpha    tau     kappa     time
-------------------------------------------------------------------------------------------------
  0  1.0e+00  4.1e-01  2.4e+00  1.0e+00  1.4142e+00  0.0000e+00   0.000  1.0e+00  1.0e+00     0.0
  1  1.7e-01  6.9e-02  4.0e-01  1.7e-01  1.1089e+00  9.0709e-01   0.841  7.9e-01  2.4e-01     0.0
  2  1.7e-02  7.1e-03  4.1e-02  1.7e-02  1.0115e+00  9.9023e-01   0.900  7.8e-01  2.5e-02     0.0
  3  1.7e-03  7.1e-04  4.2e-03  1.7e-03  1.0012e+00  9.9901e-01   0.900  7.8e-01  2.5e-03     0.0
  4  1.7e-04  7.2e-05  4.2e-04  1.7e-04  1.0001e+00  9.9990e-01   0.900  7.8e-01  2.5e-04     0.0
  5  1.8e-05  7.3e-06  4.2e-05  1.7e-05  1.0000e+00  9.9999e-01   0.900  7.8e-01  2.5e-05     0.0
  6  1.8e-06  7.3e-07  4.3e-06  1.8e-06  1.0000e+00  1.0000e+00   0.900  7.8e-01  2.6e-06     0.0
  7  1.8e-07  7.4e-08  4.3e-07  1.8e-07  1.0000e+00  1.0000e+00   0.900  7.8e-01  2.6e-07     0.0
  8  1.8e-08  7.5e-09  4.4e-08  1.8e-08  1.0000e+00  1.0000e+00   0.900  7.8e-01  2.6e-08     0.0
  9  5.9e-09  7.5e-10  4.4e-09  2.7e-09  1.0000e+00  1.0000e+00   0.900  7.3e-01  4.2e-09     0.0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The extra information displayed after solving is as follows.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Solution info:
--------------
Average objective:      1.0000000
Iterations:             9
Primal infeasibility:   8.1e-09
Dual infeasiblity:      1.0e-09
Relative duality gap:   1.3e-10
x = [ 1.0000000 0.0000000 1.0000000 ]
y = [ 1.0000000 ]
s = [ 1.0000000 0.0000000 -1.0000000 ]

Problem size:
-------------
Number of constraints:          1 (originally          1)
Number of variables:            3 (originally          3)
Second-order cones:             1
Non-zeros in A:                 1 (originally          1)
Non-zeros in M:                 1
Non-zeros in L:                 1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name>Wolf Optimization Pty Ltd</name></author><summary type="html">C quick start The below solves the problem $\min. x_1, \textrm{subject to } x_3 = 1, x_1 \ge \sqrt{x_2^2 + x_3^2}$. This obviously has the optimal solution $x= (1, 0, 1)^T$.</summary></entry><entry><title type="html">Overview</title><link href="https://www.wolfoptimization.com/overview.html" rel="alternate" type="text/html" title="Overview" /><published>2021-09-21T00:00:00+00:00</published><updated>2021-09-21T00:00:00+00:00</updated><id>https://www.wolfoptimization.com/overview</id><content type="html" xml:base="https://www.wolfoptimization.com/overview.html">&lt;h1 id=&quot;introduction&quot;&gt;Introduction&lt;/h1&gt;
&lt;p&gt;The Wolf Optimization solver is a high-performance implementation of a simplified homogeneous self-dual primal-dual interior-point method that is especially efficient at solving large, sparse conic optimization problems. A brief overview of the capabilities and interfaces is included below.&lt;/p&gt;

&lt;h1 id=&quot;conic-constraints&quot;&gt;Conic constraints&lt;/h1&gt;
&lt;p&gt;The Wolf conic optimization solver currently accepts the following conic constraints:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Linear or non-negative orthant, $x \ge 0$&lt;/li&gt;
  &lt;li&gt;Second-order cone of size $n$ (also known as the conic quadratic cone and Lorentz cone), $x_1 \ge \sqrt{x_2^2 + … + x_n^2}$&lt;/li&gt;
  &lt;li&gt;Rotated second-order cone of size $n$ (also known as the rotated conic quadratic cone), $2x_1x_2 \ge x_3^2 + … + x_n^2$
[//] # “- Semidefinite cone of size $n \times n$, $v^TXv \ge 0 \, \forall \, v \in \mathbb{R}^n$ (i.e. the symmetric matrix $X$ is positive semidefinite or, equivalently, does not have negative eigenvalues)”&lt;/li&gt;
  &lt;li&gt;Power cone, $x_1^\alpha x_2^{1-\alpha} \ge |x_3|, \, x_1,x_2 \ge 0$
[//] # “- Exponential cone, $x_1 \ge x_2 e^{x_3/x_2}$”&lt;/li&gt;
  &lt;li&gt;Free cone, $x \in \mathbb{R}$. While free variables have conventionally been transformed into the difference between two linear variables, it can be advantageous to try and eliminate the free variables from the problem and thus reducing the size of the problem being solved. Those that are not eliminated can then be dealt with explicitly or transformed into linear variables.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;interfaces&quot;&gt;Interfaces&lt;/h1&gt;
&lt;p&gt;The Wolf solver is compiled from C into a library. The library has been tested using C, C#, and MATLAB. Refer to the &lt;a href=&quot;/user-manual.html&quot;&gt;User Manual&lt;/a&gt; for guidance, or see &lt;a href=&quot;/c-interface.html&quot;&gt;here&lt;/a&gt; to get started quickly in C.&lt;/p&gt;</content><author><name>Wolf Optimization Pty Ltd</name></author><summary type="html">Introduction The Wolf Optimization solver is a high-performance implementation of a simplified homogeneous self-dual primal-dual interior-point method that is especially efficient at solving large, sparse conic optimization problems. A brief overview of the capabilities and interfaces is included below.</summary></entry><entry><title type="html">User Manual</title><link href="https://www.wolfoptimization.com/user-manual.html" rel="alternate" type="text/html" title="User Manual" /><published>2021-09-21T00:00:00+00:00</published><updated>2021-09-21T00:00:00+00:00</updated><id>https://www.wolfoptimization.com/user-manual</id><content type="html" xml:base="https://www.wolfoptimization.com/user-manual.html">&lt;h1 id=&quot;the-user-manual&quot;&gt;The user manual&lt;/h1&gt;
&lt;p&gt;A PDF user manual is available &lt;a href=&quot;public/Wolf_user_manual.pdf&quot;&gt;here&lt;/a&gt;. While not specifically about the Wolf solver, Chapters 3 and 5 of &lt;a href=&quot;public/Thesis_Nathan_Podlich.pdf&quot;&gt;this thesis&lt;/a&gt; does delve into the relative performance benefits of various solver components in the context of large sparse problems from finite element limit analysis.&lt;/p&gt;</content><author><name>Wolf Optimization Pty Ltd</name></author><summary type="html">The user manual A PDF user manual is available here. While not specifically about the Wolf solver, Chapters 3 and 5 of this thesis does delve into the relative performance benefits of various solver components in the context of large sparse problems from finite element limit analysis.</summary></entry></feed>