---
title: "Get Problem"
method: POST
path: "/problem/get"
---

# Get Problem

`POST /problem/get`

Get the model of a specific problem.

Args:
    request (ProblemGetRequest): the request containing the problem's id `problem_id`.
    user (Annotated[User, Depends): the current user.
    session (Annotated[Session, Depends): the database session.

Raises:
    HTTPException: could not find a problem with the given id.

Returns:
    ProblemInfo: detailed information on the requested problem.

## Request body

- ProblemGetRequest — Model to deal with problem fetching requests.
  - `problem_id` integer, required

## Response `200`

Successful Response

- ProblemInfo — .
  - `name` string, required
  - `description` string, required
  - `is_convex` boolean, nullable, required
  - `is_linear` boolean, nullable, required
  - `is_twice_differentiable` boolean, nullable, required
  - `scenario_keys` string[], nullable, required
  - `variable_domain` 'continuous' | 'binary' | 'integer' | 'mixed', required — An enumerator for the possible variable type domains of a problem.
  - `id` integer, required
  - `user_id` integer, required
  - `constants` ConstantDB[], nullable, required
    - `name` string, required — Descriptive name of the constant. This can be used in UI and visualizations. Example: 'maximum cost'.
    - `symbol` string, required — Symbol to represent the constant. This will be used in the rest of the problem definition. It may also be used in UIs and visualizations. Example: 'c_1'.
    - `value` number, required — The value of the constant.
    - `id` integer, nullable
    - `problem_id` integer, nullable
  - `tensor_constants` TensorConstantDB[], nullable, required
    - `values` union, required
      - TensorOutput[]
      - union[]
        - union
          - number
          - integer
          - boolean
      - number
      - integer
      - boolean
      - 'List'
    - `shape` integer[], required
    - `name` string, required — Descriptive name of the tensor representing the values. E.g., 'distances'
    - `symbol` string, required — Symbol to represent the constant. This will be used in the rest of the problem definition. Notice that the elements of the tensor will be represented with the symbol followed by indices. E.g., the first element of the third element of a 2-dimensional tensor, is represented by 'x_1_3', where 'x' is the symbol given to the TensorVariable. Note that indexing starts from 1.
    - `id` integer, nullable
    - `problem_id` integer, nullable
  - `variables` VariableDB[], nullable, required
    - `name` string, required — Descriptive name of the variable. This can be used in UI and visualizations. Example: 'velocity'.
    - `symbol` string, required — Symbol to represent the variable. This will be used in the rest of the problem definition. It may also be used in UIs and visualizations. Example: 'v_1'.
    - `variable_type` 'real' | 'integer' | 'binary', required — An enumerator for possible variable types.
    - `lowerbound` number, nullable — Lower bound of the variable.
    - `upperbound` number, nullable — Upper bound of the variable.
    - `initial_value` number, nullable — Initial value of the variable. This is optional.
    - `id` integer, nullable
    - `problem_id` integer, nullable
  - `tensor_variables` TensorVariableDB[], nullable, required
    - `initial_values` union, required
      - TensorOutput[]
      - union[]
        - union
          - number
          - integer
          - boolean
      - number
      - integer
      - boolean
      - 'List'
    - `lowerbounds` union, required
      - TensorOutput[]
      - union[]
        - union
          - number
          - integer
          - boolean
      - number
      - integer
      - boolean
      - 'List'
    - `upperbounds` union, required
      - TensorOutput[]
      - union[]
        - union
          - number
          - integer
          - boolean
      - number
      - integer
      - boolean
      - 'List'
    - `shape` integer[], required
    - `name` string, required — Descriptive name of the variable. This can be used in UI and visualizations. Example: 'velocity'.
    - `symbol` string, required — Symbol to represent the variable. This will be used in the rest of the problem definition. Notice that the elements of the tensor will be represented with the symbol followed by indices. E.g., the first element of the third element of a 2-dimensional tensor, is represented by 'x_1_3', where 'x' is the symbol given to the TensorVariable. Note that indexing starts from 1.
    - `variable_type` 'real' | 'integer' | 'binary', required — An enumerator for possible variable types.
    - `id` integer, nullable
    - `problem_id` integer, nullable
  - `objectives` ObjectiveDB[], required
    - `func` unknown[], nullable, required
      - unknown
    - `scenario_keys` string[], nullable
    - `surrogates` string[], nullable
    - `simulator_path` string, path, nullable
    - `name` string, required — Descriptive name of the objective function. This can be used in UI and visualizations. Example: 'time'.
    - `symbol` string, required — Symbol to represent the objective function. This will be used in the rest of the problem definition. It may also be used in UIs and visualizations. Example: 'f_1'.
    - `unit` string, nullable — The unit of the objective function. This is optional. Used in UIs and visualizations. Example: 'seconds' or 'millions of hectares'.
    - `maximize` boolean — Whether the objective function is to be maximized or minimized.
    - `ideal` number, nullable — Ideal value of the objective. This is optional.
    - `nadir` number, nullable — Nadir value of the objective. This is optional.
    - `objective_type` 'analytical' | 'data_based' | 'simulator' | 'surrogate' — An enumerator for supported objective function types.
    - `is_linear` boolean — Whether the function expression is linear or not. Defaults to `False`.
    - `is_convex` boolean — Whether the function expression is convex or not (non-convex). Defaults to `False`.
    - `is_twice_differentiable` boolean — Whether the function expression is twice differentiable or not. Defaults to `False`
    - `id` integer, nullable
    - `problem_id` integer, nullable
  - `constraints` ConstraintDB[], nullable, required
    - `func` unknown[], required
      - unknown
    - `scenario_keys` string[], nullable
    - `surrogates` string[], nullable
    - `simulator_path` string, path, nullable
    - `name` string, required — Descriptive name of the constraint. This can be used in UI and visualizations. Example: 'maximum length'.
    - `symbol` string, required — Symbol to represent the constraint. This will be used in the rest of the problem definition. It may also be used in UIs and visualizations. Example: 'g_1'.
    - `cons_type` '=' | '<=', required — An enumerator for supported constraint expression types.
    - `is_linear` boolean — Whether the constraint is linear or not. Defaults to True, e.g., a linear constraint is assumed.
    - `is_convex` boolean — Whether the function expression is convex or not (non-convex). Defaults to `False`.
    - `is_twice_differentiable` boolean — Whether the function expression is twice differentiable or not. Defaults to `False`
    - `id` integer, nullable
    - `problem_id` integer, nullable
  - `scalarization_funcs` ScalarizationFunctionDB[], nullable, required
    - `func` unknown[], required
      - unknown
    - `scenario_keys` string[], required
    - `name` string, required — Name of the scalarization function.
    - `symbol` string, nullable — Optional symbol to represent the scalarization function. This may be used in UIs and visualizations.
    - `is_linear` boolean — Whether the function expression is linear or not. Defaults to `False`.
    - `is_convex` boolean — Whether the function expression is convex or not (non-convex). Defaults to `False`.
    - `is_twice_differentiable` boolean — Whether the function expression is twice differentiable or not. Defaults to `False`
    - `id` integer, nullable
    - `problem_id` integer, nullable
  - `extra_funcs` ExtraFunctionDB[], nullable, required
    - `func` unknown[], required
      - unknown
    - `scenario_keys` string[], nullable
    - `surrogates` string[], nullable
    - `simulator_path` string, path, nullable
    - `name` string, required — Descriptive name of the function. Example: 'normalization'.
    - `symbol` string, required — Symbol to represent the function. This will be used in the rest of the problem definition. It may also be used in UIs and visualizations. Example: 'avg'.
    - `is_linear` boolean — Whether the function expression is linear or not. Defaults to `False`.
    - `is_convex` boolean — Whether the function expression is convex or not (non-convex). Defaults to `False`.
    - `is_twice_differentiable` boolean — Whether the function expression is twice differentiable or not. Defaults to `False`
    - `id` integer, nullable
    - `problem_id` integer, nullable
  - `discrete_representation` DiscreteRepresentationDB, required — The SQLModel equivalent to `DiscreteRepresentation`.
    - `non_dominated` boolean
    - `variable_values` object, required
    - `objective_values` object, required
    - `id` integer, nullable
    - `problem_id` integer, nullable
  - `simulators` SimulatorDB[], nullable, required
    - `file` string, path, required
    - `parameter_options` object, nullable
    - `name` string, required — Descriptive name of the simulator. This can be used in UI and visualizations.
    - `symbol` string, required — Symbol to represent the simulator. This will be used in the rest of the problem definition. It may also be used in UIs and visualizations.
    - `id` integer, nullable
    - `problem_id` integer, nullable

## Other responses

- `422` — Validation Error

## Changes

- **2025-05-20** `bbcc40488a72` — 1 breaking, 1 warning, 12 info
  - removed the required property `problem_metadata` from the response with the `200` status
  - removed the optional property `simulators/anyOf[subschema #1]/items/url` from the response with the `200` status
  - the endpoint scheme security `APIKeyCookie` was removed from the API
  - added `#/components/schemas/Tensor-Output` to the `tensor_variables/anyOf[subschema #1]/items/initial_values` response property `anyOf` list for the response status `200`
  - …10 more

[Change history](https://skmtc.dev/industrial-optimization-group/apis/desdeo-fast-api/changes/problem/get/post.md)

---

[API](https://skmtc.dev/industrial-optimization-group/apis/desdeo-fast-api.md) · [All operations](https://skmtc.dev/industrial-optimization-group/apis/desdeo-fast-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/industrial-optimization-group/desdeo-fast-api/revisions/bbcc40488a72/schema)
