OptimizeResponse

Object containing the optimization results and all of the metrics returned by the solver.

titanq.OptimizeResponse.computation_id(self) UUID

The computation id is a Universal unique id that identify this computation inside the TitanQ platform.

Provide this id on any support request to the InfinityQ.

Returns

The computation id of this solve.

Raises

UnexpectedServerResponseError

The server response doesn’t contain a computation id

titanq.OptimizeResponse.computation_metrics(self, key: str = None) Any

The computation metrics the solver returns

Returns

All computation metrics if no key is given of the specific metrics with the associated key if one is provided.

Raises

UnexpectedServerResponseError

The server response doesn’t contain the computation metrics or the passed key

titanq.OptimizeResponse.constraint_violations(self) Tuple[List[int] | None, List[List[int]] | None]

Obtain constraint violations for each engine (num_engines). If no constraints were used in the computation, the values will be None.

Return

A tuple of two lists - First list indicate the total number of constraint violations for each engine - Second list contains a list of the constraint violation indexes for each engine

titanq.OptimizeResponse.metrics(self, key: str = None) str | Dict[str, Any]

Deprecated since version 0.7.0: Use computation_metrics() or original_input_params() instead.

Returns

All metrics if no key is given. A specific metric with the associated key if one is provided.

Raises

UnexpectedServerResponseError

The server response doesn’t contain the metrics or the passed key

titanq.OptimizeResponse.original_input_params(self, key: str = None) Any

Deprecated since version 0.29.0: Use parameters_used() instead.

The original input params sent to the solver

Returns

All original params if no key is given. A specific param with the associated key if one is provided.

Raises

UnexpectedServerResponseError

The server response doesn’t contain the original input parameters or the passed key

titanq.OptimizeResponse.parameters_used(self, key: str = None) Any

The actual parameters used by the solver. If a parameter was not used, the value will be set to None.

Returns

The parameters used by the solver

Raises

UnexpectedServerResponseError

The server response doesn’t contain the parameters used or the passed key

titanq.OptimizeResponse.problem_shape(self, key: str = None) Any

The problem shape analyzed by the solver

Returns

The problem shape

Raises

UnexpectedServerResponseError

The server response doesn’t contain the problem shape or the passed key

titanq.OptimizeResponse.result_items(self) List[Tuple[float, ndarray]]

ex. [(-10000, [0, 1, 1, 0]), (-20000, [1, 0, 1, 0]), …]

Returns

List of tuples containing the solutions objective value and its corresponding result vector

titanq.OptimizeResponse.result_vector(self) ndarray

The result vector

Returns

The result vector of this optimization.

titanq.OptimizeResponse.solver_used(self) str

The solver class used for the computation

Returns

The solver class used

Raises

UnexpectedServerResponseError

The server response doesn’t contain the solver used

titanq.OptimizeResponse.total_number_of_constraints(self) int

Returns the number of constraints passed to the solver for the computation.

Returns

The number of constraints, or 0 if no constraints were defined in the request.