> For the complete documentation index, see [llms.txt](https://docs.grix.finance/grix/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.grix.finance/grix/grix-protocol/optimization-layer.md).

# Optimization Layer

The optimization layer is the brain behind the Grix protocol, where the route optimization decisions are made. As part of the protocol’s model, it “outsources” part of the heavy calculation to [solvers](/grix/grix-protocol/solvers-network.md) that specialize in finding the optimal route for the order flow. In order to facilitate and incentivize the solvers, there are many small processes happening before and after the route calculations - all done by **Socrates** component.

Socrates serves as the manager within the optimization layer, tasked with the key role of parsing incoming order flow, and managing the route optimization auction. Socrates oversees the competitive routing process, where solvers provide solutions for the optimal trade. It processes the solutions offered by solvers and organizes them into prioritized batches, ensuring that the most efficient and effective solutions are queued for execution. To make sure the winning solver is not acting in bad faith,  verification of routes and transaction simulations are applied.

The significant components and functions operated by the Optimization Layer is indicated in the following simplified overview:

<figure><img src="/files/cDXvvOAPhBqLTfP7oQiD" alt=""><figcaption><p>The Optimization Layer</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.grix.finance/grix/grix-protocol/optimization-layer.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
