# Appendix 1 \~ Dual Problem

Consider the primal problem as defined below.<br>

<figure><img src="https://3638569340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F285cQB8JvZvGTLxQWiRv%2Fuploads%2FiEtR70pQZFCVqFKsw4rO%2Fimage.png?alt=media&#x26;token=12e16c62-51dd-4545-b8f6-cc2f063420da" alt=""><figcaption></figcaption></figure>

\
The construction of the dual problem is generated by first forming the Lagragian function as defined below.

<figure><img src="https://3638569340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F285cQB8JvZvGTLxQWiRv%2Fuploads%2FR6uKVljIHSo3Cg4rC9mQ%2Fimage.png?alt=media&#x26;token=ad83a979-fba6-417e-9342-cd72d92ca48b" alt=""><figcaption></figcaption></figure>

A Lagrangian function is used in constrained optimization to find the maximum or minimum of a function subject to one or more constraints.  Solving the system of equations where the partial derivatives of the Lagrangian with respect to the objective function and slacked constraints are set to zero identifies potential optimal points for the constrained optimization problem.\
\
The partial derivitive of the Lagrangian with respect to ***T*** and ***x*** are:

<figure><img src="https://3638569340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F285cQB8JvZvGTLxQWiRv%2Fuploads%2FpCRfjpk4KSQVC5FM1JxA%2Fimage.png?alt=media&#x26;token=16756d08-40e9-40fc-ab75-d31ffe74ff28" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3638569340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F285cQB8JvZvGTLxQWiRv%2Fuploads%2F72bQ201gkwvCWthMuLnH%2Fimage.png?alt=media&#x26;token=18850b7a-af46-4dd9-b0f0-a27d7d4842b2" alt=""><figcaption></figcaption></figure>

(Note this is for all miners from ***1..n.)***\
\
At the optimum is must hold true that the inequality constraints under stationary conditions are also equal to 0 and so we can list them all here as follows:\
\
**Budget Cap:**

<figure><img src="https://3638569340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F285cQB8JvZvGTLxQWiRv%2Fuploads%2FrAg5naxsg44TqeqH95a9%2Fimage.png?alt=media&#x26;token=230d850a-7a9d-4730-8ef3-00708a8efe96" alt=""><figcaption></figcaption></figure>

**Payout Rate Cap:**

<figure><img src="https://3638569340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F285cQB8JvZvGTLxQWiRv%2Fuploads%2F7kL5Qly8nheiApASpAY8%2Fimage.png?alt=media&#x26;token=0058a538-fb11-40bc-891a-a71b078d2d6f" alt=""><figcaption></figcaption></figure>

**Diversity:**

<figure><img src="https://3638569340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F285cQB8JvZvGTLxQWiRv%2Fuploads%2FR8YtxYQI2vgdyhdMdx4z%2Fimage.png?alt=media&#x26;token=5b74d345-c5a9-4f2c-a5e5-ff8e0f001c9e" alt=""><figcaption></figcaption></figure>

**Ramp Constraint (upper/lower):**

<figure><img src="https://3638569340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F285cQB8JvZvGTLxQWiRv%2Fuploads%2Fz9YHNXv3tE1Ovois25iD%2Fimage.png?alt=media&#x26;token=875b8ae2-cb7c-4046-ad73-7a149eedefd3" alt=""><figcaption></figcaption></figure>

**Box Constraints:**

<figure><img src="https://3638569340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F285cQB8JvZvGTLxQWiRv%2Fuploads%2FVSBmQwLXLiyZpPMAl7bM%2Fimage.png?alt=media&#x26;token=819cd119-7461-4997-9599-b5dc3fdef523" alt=""><figcaption></figcaption></figure>

**Eligibility:**<br>

<figure><img src="https://3638569340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F285cQB8JvZvGTLxQWiRv%2Fuploads%2FOjemQi8L0mgkQ9SgRVmY%2Fimage.png?alt=media&#x26;token=684d3f38-4d5e-40e6-a78b-e093b95da626" alt=""><figcaption></figcaption></figure>

With all of these constraints defined all original primal constraints must hold as well as all dual variables respecting their signs:

<figure><img src="https://3638569340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F285cQB8JvZvGTLxQWiRv%2Fuploads%2FBBuTYJ6J23b65MAS8F3J%2Fimage.png?alt=media&#x26;token=ef12a25d-0bae-45b3-948a-5291ca0304df" alt=""><figcaption></figcaption></figure>

With these complementary slackness relations, primal feasibility, dual feasibility, and the stationarity conditions, we obtain the full set of Karush–Kuhn–Tucker (KKT) conditions. Together they are necessary and sufficient for optimality in this convex program. In other words, the primal solution **(x\*, T\*)** and the corresponding dual variables:

<figure><img src="https://3638569340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F285cQB8JvZvGTLxQWiRv%2Fuploads%2F4LMfOkQJ7rnNIsh6qMuE%2Fimage.png?alt=media&#x26;token=f596722e-dbed-47d1-92fb-3dfdf263e595" alt=""><figcaption></figcaption></figure>

must jointly satisfy this system. Once these conditions hold, the allocation vector and dual shadow prices define both the optimal routing of qualified volume and the “scoreboard” of binding constraints that govern the incentive mechanism.
