Optimization Problems

Optimization problems involve finding the best set of parameters or conditions that maximize or minimize a particular objective function, subject to a set of constraints.


The Main Underlying Goal

Consider an executed user order s, where S represents its executed sell amount and B is its executed buy amount. Then:

where

The order can be executed only if:

Moreover, if the order is executed, we must have:

In the case of a fill-or-kill order, the inequality must be satisfied with equality:

Given the above definitions, the goal when matching a user order against liquidity sources is to maximize the surplus of the user order:


The Utility Function (Ω)

As seen above, the utility (or objective) function encodes what is desired to maximize under given constraints.

Another example is that in the context of optimal arbitrage, the utility function could encode the goal of finding the best net trade that is entirely nonnegative.

Yet another example is swapping token PHI for token MU, aiming to maximize the output of token MU given a fixed input of token PHI (with arbitrage opportunities captured as part of the swap).

Last updated