> 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="https://content.gitbook.com/content/n3odl4ymHi6P7lINhkcx/blobs/okXNahPLGSacfvetbMEE/Optimization%20Layer.png" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
