> For the complete documentation index, see [llms.txt](https://globalmoo.gitbook.io/globalmoo-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://globalmoo.gitbook.io/globalmoo-documentation/schemas/inverse.md).

# Inverse Schema

Inverse objects represent steps in the inverse solution and/or optimization process.

## Schema

```json
{
    "id": 123,
    "created_at": "2025-01-31T10:00:00.000Z",
    "updated_at": "2025-01-31T10:00:00.000Z",
    "disabled_at": null,
    "loaded_at": "2025-01-31T10:00:01.000Z",
    "satisfied_at": null,
    "stopped_at": null,
    "exhausted_at": null,
    "iteration": 1,
    "l1_norm": 0.001,
    "suggest_time": 125000000,
    "compute_time": 50000000,
    "input": [1.0, 2.0, 3.0],
    "output": [4.0, 5.0, 6.0],
    "results": [
        // Result objects
    ]
}
```

## Fields

| Field         | Type           | Required | Description                    |
| ------------- | -------------- | -------- | ------------------------------ |
| id            | integer        | Yes      | Unique identifier              |
| created\_at   | string         | Yes      | Creation timestamp             |
| updated\_at   | string         | Yes      | Last update timestamp          |
| disabled\_at  | string         | No       | Disable timestamp              |
| loaded\_at    | string         | No       | When output was loaded         |
| satisfied\_at | string         | No       | When all objectives satisfied  |
| stopped\_at   | string         | No       | When manually stopped          |
| exhausted\_at | string         | No       | When max iterations reached    |
| iteration     | integer        | Yes      | Current iteration number       |
| l1\_norm      | float          | Yes      | Current L1 norm error          |
| suggest\_time | integer        | Yes      | Suggestion time (nanoseconds)  |
| compute\_time | integer        | Yes      | Computation time (nanoseconds) |
| input         | array\[float]  | Yes      | Input parameter values         |
| output        | array\[float]  | No       | Output values (if loaded)      |
| results       | array\[Result] | No       | Individual objective results   |

## Stop Reasons

The stop reason can be determined from timestamps:

| Reason    | Status | Description            |
| --------- | ------ | ---------------------- |
| Running   | 0      | No stop timestamps set |
| Satisfied | 1      | satisfied\_at is set   |
| Stopped   | 2      | stopped\_at is set     |
| Exhausted | 3      | exhausted\_at is set   |

Priority order if multiple set:

1. satisfied\_at
2. stopped\_at
3. exhausted\_at

## Input/Output Arrays

* input array length must match project input\_count
* output array length must match objective count
* all values must be valid floats/integers
* arrays must not contain null values

## Performance Metrics

* suggest\_time: Time to generate next inputs
* compute\_time: Time to evaluate outputs
* Higher times may indicate:
  * Complex objective landscape
  * Numerical instability
  * Resource constraints

## Results Array

Contains Result objects matching objective count:

* One Result per objective
* Result.number matches objective index
* Results track satisfaction status
* Null until output is loaded
* All results must be satisfied for inverse.satisfied\_at to be set

## Usage Notes

1. Check stopReason using helper methods:

   ```python
   if inverse.should_stop():
       reason = inverse.get_stop_reason()
   ```
2. Examine results for detailed status:

   ```python
   for result in inverse.results:
       print(f"Objective {result.number}: {'✓' if result.satisfied else '✗'}")
   ```
3. Monitor performance:

   ```python
   print(f"Suggestion took {inverse.suggest_time/1000000:.2f}ms")
   print(f"Computation took {inverse.compute_time/1000000:.2f}ms")
   ```
4. Track convergence:

   ```python
   print(f"Current L1 norm: {inverse.l1_norm}")
   ```
