Suggest Inverse Step
Suggests the next set of input values for inverse optimization.
Endpoint
POST /models/{model_id}/projects/{project_id}/trials/{trial_id}/objectives/{objective_id}/inverses
Path Parameters
model_id
integer
Yes
ID of the model
project_id
integer
Yes
ID of the project
trial_id
integer
Yes
ID of the trial
objective_id
integer
Yes
ID of the objective
Response Format
{
"id": 123,
"input": [1.2, 3.4, 5.6],
"iteration": 2,
"status": "active",
"convergence": 0.0025,
"suggestTime": 125000000,
"computeTime": 0,
"createdAt": "2025-01-31T10:00:00.000Z",
"updatedAt": "2025-01-31T10:00:00.000Z",
"results": [
{
"number": 0,
"type": "exact",
"objective": 100.0,
"minimumBound": null,
"maximumBound": null,
"output": 98.5,
"error": 1.5,
"detail": "Error exceeds L1 norm threshold",
"satisfied": false
},
{
"number": 1,
"type": "lessthan",
"objective": 50.0,
"minimumBound": null,
"maximumBound": null,
"output": 45.2,
"error": 0.0,
"detail": "Output is less than target",
"satisfied": true
}
]
}
Status Values
Possible status values are:
active
- Inverse iteration is active and runningconverged
- Iteration has reached convergence criterionmax_iterations
- Maximum number of iterations reachedstopped
- Iteration was manually stoppedfailed
- Iteration failed due to an error
Examples
from globalmoo import Client
client = Client(api_key="your-api-key")
suggestion = client.suggest_inverse(
model_id=123,
project_id=456,
trial_id=789,
objective_id=12
)
print(f"Suggested inputs: {[f'{x:.4f}' for x in suggestion.input]}")
print(f"Iteration: {suggestion.iteration}")
print(f"Status: {suggestion.status}")
print(f"Suggest time: {suggestion.suggest_time/1000000:.2f}ms")
# Check detailed objective results
print("\nObjective Status:")
for result in suggestion.results:
print(f"\nObjective {result.number}:")
print(f" Type: {result.type}")
print(f" Target: {result.objective:.4f}")
print(f" Output: {result.output:.4f}")
print(f" Error: {result.error:.6f}")
print(f" Satisfied: {'✓' if result.satisfied else '✗'}")
print(f" Detail: {result.detail}")
Error Responses
401
Unauthorized - Invalid API key
404
Model, project, trial, or objective not found
409
Conflict - Previous iteration not completed
429
Too many requests - Rate limit exceeded
500
Internal server error
Validation Rules
Model, project, trial, and objective IDs must be positive integers
Previous iteration must be completed before requesting next suggestion
Trial must be in an active state
Objective must have valid initial values loaded
Values in response will be floating point numbers
Last updated