---
title: "Iterate"
method: POST
path: "/method/emo/iterate"
tags: ["EMO"]
---

# Iterate

`POST /method/emo/iterate`

Starts the EMO method.

Args:
    request (EMOSolveRequest): The request object containing parameters for the EMO method.
    user (Annotated[User, Depends]): The current user.
    session (Annotated[Session, Depends]): The database session.

Raises:
    HTTPException: If the request is invalid or the EMO method fails.

Returns:
    IterateResponse: A response object containing a list of IDs to be used for websocket communication.
        Also contains the StateDB id where the results will be stored.

## Request body

- EMOIterateRequest — Model of the request to iterate an EMO method.
  - `problem_id` integer, required — Database ID of the problem to solve.
  - `session_id` integer, nullable
  - `parent_state_id` integer, nullable — State ID of the parent state, if any. Should be None if this is the first state in a session.
  - `template_options` union[], nullable — Options for the template to use. A list of options can be given if multiple templates are used in parallel.
    - union
      - Template1Options — Options for template 1. Template 1 is used by methods such as NSGA-III and RVEA. See [template1][desdeo.emo.methods.templates.template1] for more details.
        - `crossover` union, required — The crossover operator options.
          - SimulatedBinaryCrossoverOptions — Options for Simulated Binary Crossover (SBX).
            - `name` 'SimulatedBinaryCrossover' — The name of the crossover operator.
            - `xover_probability` number — The SBX crossover probability.
            - `xover_distribution` number — The SBX distribution index.
          - SinglePointBinaryCrossoverOptions — Options for Single Point Binary Crossover.
            - `name` 'SinglePointBinaryCrossover' — The name of the crossover operator.
          - UniformIntegerCrossoverOptions — Options for Uniform Integer Crossover.
            - `name` 'UniformIntegerCrossover' — The name of the crossover operator.
          - UniformMixedIntegerCrossoverOptions — Options for Uniform Mixed Integer Crossover.
            - `name` 'UniformMixedIntegerCrossover' — The name of the crossover operator.
          - BlendAlphaCrossoverOptions — Options for Blend Alpha Crossover.
            - `name` 'BlendAlphaCrossover' — The name of the crossover operator.
            - `alpha` number — Non-negative blending factor 'alpha' that controls the extent to which offspring may be sampled outside the interval defined by each pair of parent genes. alpha = 0 restricts children strictly within the parents range, larger alpha allows some outliers.
            - `xover_probability` number
          - SingleArithmeticCrossoverOptions — Options for Single Arithmetic Crossover.
            - `name` 'SingleArithmeticCrossover' — The name of the crossover operator.
            - `xover_probability` number — The crossover probability.
          - LocalCrossoverOptions — Options for Local Crossover.
            - `name` 'LocalCrossover' — The name of the crossover operator.
            - `xover_probability` number — The crossover probability.
          - BoundedExponentialCrossoverOptions — Options for Bounded Exponential Crossover.
            - `name` 'BoundedExponentialCrossover' — The name of the crossover operator.
            - `xover_probability` number — The crossover probability.
            - `lambda_` number — Positive scale λ for the exponential distribution.
        - `mutation` union, required — The mutation operator options.
          - BoundedPolynomialMutationOptions — Options for Bounded Polynomial Mutation.
            - `name` 'BoundedPolynomialMutation' — The name of the mutation operator.
            - `mutation_probability` number, nullable — The probability of mutation. Defaults to None, which sets the mutation probability to 1/<number of decision variables>.
            - `distribution_index` number — The distribution index.
          - BinaryFlipMutationOptions — Options for Binary Flip Mutation.
            - `name` 'BinaryFlipMutation' — The name of the mutation operator.
            - `mutation_probability` number, nullable — The probability of mutation. Defaults to None, which sets the mutation probability to 1/<number of decision variables>.
          - IntegerRandomMutationOptions — Options for Integer Random Mutation.
            - `name` 'IntegerRandomMutation' — The name of the mutation operator.
            - `mutation_probability` number, nullable — The probability of mutation. Defaults to None, which sets the mutation probability to 1/<number of decision variables>.
          - MixedIntegerRandomMutationOptions — Options for Mixed Integer Random Mutation.
            - `name` 'MixedIntegerRandomMutation' — The name of the mutation operator.
            - `mutation_probability` number, nullable — The probability of mutation. Defaults to None, which sets the mutation probability to 1/<number of decision variables>.
          - MPTMutationOptions — Options for MPT Mutation.
            - `name` 'MPTMutation' — The name of the mutation operator.
            - `mutation_probability` number, nullable — The probability of mutation. Defaults to None, which sets the mutation probability to 1/<number of decision variables>.
            - `mutation_exponent` number — Controls strength of small mutation (larger means smaller mutations).
          - NonUniformMutationOptions — Options for Non-Uniform Mutation.
            - `name` 'NonUniformMutation' — The name of the mutation operator.
            - `mutation_probability` number, nullable — The probability of mutation. Defaults to None, which sets the mutation probability to 1/<number of decision variables>.
            - `max_generations` integer, required — Maximum number of generations in the evolutionary run. Used to scale mutation decay.
            - `b` number — Non-uniform mutation decay parameter. Higher values causefaster reduction in mutation strength over generations.
          - SelfAdaptiveGaussianMutationOptions — Options for Self-Adaptive Gaussian Mutation.
            - `name` 'SelfAdaptiveGaussianMutation' — The name of the mutation operator.
            - `mutation_probability` number, nullable — The probability of mutation. Defaults to None, which sets the mutation probability to 1/<number of decision variables>.
          - PowerMutationOptions — Options for Power Mutation.
            - `name` 'PowerMutation' — The name of the mutation operator.
            - `mutation_probability` number, nullable — The probability of mutation. Defaults to None, which sets the mutation probability to 1/<number of decision variables>.
            - `p` number — Power distribution parameter. Controls the perturbation magnitude.
        - `selection` union, required — The selection operator options.
          - RVEASelectorOptions — Options for RVEA Selection.
            - `name` 'RVEASelector' — The name of the selection operator.
            - `reference_vector_options` ReferenceVectorOptions — Pydantic model for Reference Vector arguments.
              - …
            - `parameter_adaptation_strategy` 'GENERATION_BASED' | 'FUNCTION_EVALUATION_BASED' | 'OTHER' — The parameter adaptation strategies for the RVEA selector.
            - `alpha` number — The alpha parameter in the angle penalized distance.
          - NSGA3SelectorOptions — Options for NSGA-III Selection.
            - `name` 'NSGA3Selector' — The name of the selection operator.
            - `reference_vector_options` ReferenceVectorOptions — Pydantic model for Reference Vector arguments.
              - …
            - `invert_reference_vectors` boolean — Whether to invert the reference vectors (inverted triangle).
          - IBEASelectorOptions — Options for IBEA Selection.
            - `name` 'IBEASelector' — The name of the selection operator.
            - `population_size` integer, required — The population size.
            - `kappa` number — The kappa parameter for IBEA.
            - `binary_indicator` 'eps' | 'hv' — The binary indicator for IBEA.
        - `termination` union, required — The termination operator options.
          - MaxGenerationsTerminatorOptions — Options for max generations terminator operator.
            - `name` 'MaxGenerationsTerminator' — The name of the termination operator.
            - `max_generations` integer — The maximum number of generations allowed.
          - MaxEvaluationsTerminatorOptions — Options for max evaluations terminator operator.
            - `name` 'MaxEvaluationsTerminator' — The name of the termination operator.
            - `max_evaluations` integer — The maximum number of evaluations allowed.
          - MaxTimeTerminatorOptions — Options for max time terminator operator.
            - `name` 'MaxTimeTerminator' — The name of the termination operator.
            - `max_time` number — The maximum time allowed (in seconds).
          - ExternalCheckTerminatorOptions — Options for external check terminator operator. Note that the check function must be provided separately.
            - `name` 'ExternalCheckTerminator' — The name of the termination operator.
          - CompositeTerminatorOptions — Options for composite terminator operator.
            - `name` 'CompositeTerminator' — The name of the termination operator.
            - `terminators` union[] — List of terminators.
              - …
            - `mode` 'all' | 'any' — Whether to use logical AND or OR.
        - `generator` union, required — The population generator options.
          - LHSGeneratorOptions — Options for Latin Hypercube Sampling (LHS) generator.
            - `n_points` integer, required — The number of points to generate for the initial population.
            - `name` 'LHSGenerator' — The name of the generator.
          - RandomBinaryGeneratorOptions — Options for Random Binary generator.
            - `n_points` integer, required — The number of points to generate for the initial population.
            - `name` 'RandomBinaryGenerator' — The name of the generator.
          - RandomGeneratorOptions — Options for Random generator.
            - `n_points` integer, required — The number of points to generate for the initial population.
            - `name` 'RandomGenerator' — The name of the generator.
          - RandomIntegerGeneratorOptions — Options for Random Integer generator.
            - `n_points` integer, required — The number of points to generate for the initial population.
            - `name` 'RandomIntegerGenerator' — The name of the generator.
          - RandomMixedIntegerGeneratorOptions — Options for Random Mixed Integer generator.
            - `n_points` integer, required — The number of points to generate for the initial population.
            - `name` 'RandomMixedIntegerGenerator' — The name of the generator.
        - `repair` union — The repair operator options.
          - ClipRepairOptions — Options for Clip Repair.
            - `name` 'ClipRepair' — Clip the solutions to be within the variable bounds.
            - `lower_bounds` object, nullable — Lower bounds for the decision variables. If none, the lower bounds from the problem will be used.
            - `upper_bounds` object, nullable — Upper bounds for the decision variables. If none, the upper bounds from the problem will be used.
          - NoRepairOptions — Options for No Repair.
            - `name` 'NoRepair' — Do not apply any repair to the solutions.
        - `use_archive` boolean — Whether to use an archive.
        - `seed` integer — The seed for random number generation.
        - `verbosity` integer — The verbosity level of the operators.
        - `algorithm_name` string, required — The unique name of the algorithm.
        - `name` 'Template1' — The name of the template.
      - Template2Options — Options for template 2. Template 2 is used by methods such as IBEA. See [template2][desdeo.emo.methods.templates.template2] for more details.
        - `crossover` union, required — The crossover operator options.
          - SimulatedBinaryCrossoverOptions — Options for Simulated Binary Crossover (SBX).
            - `name` 'SimulatedBinaryCrossover' — The name of the crossover operator.
            - `xover_probability` number — The SBX crossover probability.
            - `xover_distribution` number — The SBX distribution index.
          - SinglePointBinaryCrossoverOptions — Options for Single Point Binary Crossover.
            - `name` 'SinglePointBinaryCrossover' — The name of the crossover operator.
          - UniformIntegerCrossoverOptions — Options for Uniform Integer Crossover.
            - `name` 'UniformIntegerCrossover' — The name of the crossover operator.
          - UniformMixedIntegerCrossoverOptions — Options for Uniform Mixed Integer Crossover.
            - `name` 'UniformMixedIntegerCrossover' — The name of the crossover operator.
          - BlendAlphaCrossoverOptions — Options for Blend Alpha Crossover.
            - `name` 'BlendAlphaCrossover' — The name of the crossover operator.
            - `alpha` number — Non-negative blending factor 'alpha' that controls the extent to which offspring may be sampled outside the interval defined by each pair of parent genes. alpha = 0 restricts children strictly within the parents range, larger alpha allows some outliers.
            - `xover_probability` number
          - SingleArithmeticCrossoverOptions — Options for Single Arithmetic Crossover.
            - `name` 'SingleArithmeticCrossover' — The name of the crossover operator.
            - `xover_probability` number — The crossover probability.
          - LocalCrossoverOptions — Options for Local Crossover.
            - `name` 'LocalCrossover' — The name of the crossover operator.
            - `xover_probability` number — The crossover probability.
          - BoundedExponentialCrossoverOptions — Options for Bounded Exponential Crossover.
            - `name` 'BoundedExponentialCrossover' — The name of the crossover operator.
            - `xover_probability` number — The crossover probability.
            - `lambda_` number — Positive scale λ for the exponential distribution.
        - `mutation` union, required — The mutation operator options.
          - BoundedPolynomialMutationOptions — Options for Bounded Polynomial Mutation.
            - `name` 'BoundedPolynomialMutation' — The name of the mutation operator.
            - `mutation_probability` number, nullable — The probability of mutation. Defaults to None, which sets the mutation probability to 1/<number of decision variables>.
            - `distribution_index` number — The distribution index.
          - BinaryFlipMutationOptions — Options for Binary Flip Mutation.
            - `name` 'BinaryFlipMutation' — The name of the mutation operator.
            - `mutation_probability` number, nullable — The probability of mutation. Defaults to None, which sets the mutation probability to 1/<number of decision variables>.
          - IntegerRandomMutationOptions — Options for Integer Random Mutation.
            - `name` 'IntegerRandomMutation' — The name of the mutation operator.
            - `mutation_probability` number, nullable — The probability of mutation. Defaults to None, which sets the mutation probability to 1/<number of decision variables>.
          - MixedIntegerRandomMutationOptions — Options for Mixed Integer Random Mutation.
            - `name` 'MixedIntegerRandomMutation' — The name of the mutation operator.
            - `mutation_probability` number, nullable — The probability of mutation. Defaults to None, which sets the mutation probability to 1/<number of decision variables>.
          - MPTMutationOptions — Options for MPT Mutation.
            - `name` 'MPTMutation' — The name of the mutation operator.
            - `mutation_probability` number, nullable — The probability of mutation. Defaults to None, which sets the mutation probability to 1/<number of decision variables>.
            - `mutation_exponent` number — Controls strength of small mutation (larger means smaller mutations).
          - NonUniformMutationOptions — Options for Non-Uniform Mutation.
            - `name` 'NonUniformMutation' — The name of the mutation operator.
            - `mutation_probability` number, nullable — The probability of mutation. Defaults to None, which sets the mutation probability to 1/<number of decision variables>.
            - `max_generations` integer, required — Maximum number of generations in the evolutionary run. Used to scale mutation decay.
            - `b` number — Non-uniform mutation decay parameter. Higher values causefaster reduction in mutation strength over generations.
          - SelfAdaptiveGaussianMutationOptions — Options for Self-Adaptive Gaussian Mutation.
            - `name` 'SelfAdaptiveGaussianMutation' — The name of the mutation operator.
            - `mutation_probability` number, nullable — The probability of mutation. Defaults to None, which sets the mutation probability to 1/<number of decision variables>.
          - PowerMutationOptions — Options for Power Mutation.
            - `name` 'PowerMutation' — The name of the mutation operator.
            - `mutation_probability` number, nullable — The probability of mutation. Defaults to None, which sets the mutation probability to 1/<number of decision variables>.
            - `p` number — Power distribution parameter. Controls the perturbation magnitude.
        - `selection` union, required — The selection operator options.
          - RVEASelectorOptions — Options for RVEA Selection.
            - `name` 'RVEASelector' — The name of the selection operator.
            - `reference_vector_options` ReferenceVectorOptions — Pydantic model for Reference Vector arguments.
              - …
            - `parameter_adaptation_strategy` 'GENERATION_BASED' | 'FUNCTION_EVALUATION_BASED' | 'OTHER' — The parameter adaptation strategies for the RVEA selector.
            - `alpha` number — The alpha parameter in the angle penalized distance.
          - NSGA3SelectorOptions — Options for NSGA-III Selection.
            - `name` 'NSGA3Selector' — The name of the selection operator.
            - `reference_vector_options` ReferenceVectorOptions — Pydantic model for Reference Vector arguments.
              - …
            - `invert_reference_vectors` boolean — Whether to invert the reference vectors (inverted triangle).
          - IBEASelectorOptions — Options for IBEA Selection.
            - `name` 'IBEASelector' — The name of the selection operator.
            - `population_size` integer, required — The population size.
            - `kappa` number — The kappa parameter for IBEA.
            - `binary_indicator` 'eps' | 'hv' — The binary indicator for IBEA.
        - `termination` union, required — The termination operator options.
          - MaxGenerationsTerminatorOptions — Options for max generations terminator operator.
            - `name` 'MaxGenerationsTerminator' — The name of the termination operator.
            - `max_generations` integer — The maximum number of generations allowed.
          - MaxEvaluationsTerminatorOptions — Options for max evaluations terminator operator.
            - `name` 'MaxEvaluationsTerminator' — The name of the termination operator.
            - `max_evaluations` integer — The maximum number of evaluations allowed.
          - MaxTimeTerminatorOptions — Options for max time terminator operator.
            - `name` 'MaxTimeTerminator' — The name of the termination operator.
            - `max_time` number — The maximum time allowed (in seconds).
          - ExternalCheckTerminatorOptions — Options for external check terminator operator. Note that the check function must be provided separately.
            - `name` 'ExternalCheckTerminator' — The name of the termination operator.
          - CompositeTerminatorOptions — Options for composite terminator operator.
            - `name` 'CompositeTerminator' — The name of the termination operator.
            - `terminators` union[] — List of terminators.
              - …
            - `mode` 'all' | 'any' — Whether to use logical AND or OR.
        - `generator` union, required — The population generator options.
          - LHSGeneratorOptions — Options for Latin Hypercube Sampling (LHS) generator.
            - `n_points` integer, required — The number of points to generate for the initial population.
            - `name` 'LHSGenerator' — The name of the generator.
          - RandomBinaryGeneratorOptions — Options for Random Binary generator.
            - `n_points` integer, required — The number of points to generate for the initial population.
            - `name` 'RandomBinaryGenerator' — The name of the generator.
          - RandomGeneratorOptions — Options for Random generator.
            - `n_points` integer, required — The number of points to generate for the initial population.
            - `name` 'RandomGenerator' — The name of the generator.
          - RandomIntegerGeneratorOptions — Options for Random Integer generator.
            - `n_points` integer, required — The number of points to generate for the initial population.
            - `name` 'RandomIntegerGenerator' — The name of the generator.
          - RandomMixedIntegerGeneratorOptions — Options for Random Mixed Integer generator.
            - `n_points` integer, required — The number of points to generate for the initial population.
            - `name` 'RandomMixedIntegerGenerator' — The name of the generator.
        - `repair` union — The repair operator options.
          - ClipRepairOptions — Options for Clip Repair.
            - `name` 'ClipRepair' — Clip the solutions to be within the variable bounds.
            - `lower_bounds` object, nullable — Lower bounds for the decision variables. If none, the lower bounds from the problem will be used.
            - `upper_bounds` object, nullable — Upper bounds for the decision variables. If none, the upper bounds from the problem will be used.
          - NoRepairOptions — Options for No Repair.
            - `name` 'NoRepair' — Do not apply any repair to the solutions.
        - `use_archive` boolean — Whether to use an archive.
        - `seed` integer — The seed for random number generation.
        - `verbosity` integer — The verbosity level of the operators.
        - `algorithm_name` string, required — The unique name of the algorithm.
        - `name` 'Template2' — The name of the template.
        - `mate_selection` union, required — The mate selection operator options.
          - TournamentSelectionOptions — Options for tournament selection operator.
            - `name` 'TournamentSelection' — The name of the scalar selection operator.
            - `tournament_size` integer — The number of individuals participating in the tournament.
            - `winner_size` integer, required — The number of winners to select (equivalent to population size).
          - RouletteWheelSelectionOptions — Options for roulette wheel selection operator.
            - `name` 'RouletteWheelSelection' — The name of the scalar selection operator.
            - `tournament_size` integer — The number of individuals participating in the tournament.
            - `winner_size` integer, required — The number of winners to select (equivalent to population size).
  - `preference_options` union — Options for the preference handling.
    - ReferencePointOptions — Options for providing a reference point for an EA.
      - `name` 'reference_point' — The name of the reference point option.
      - `preference` object, required — The reference point as a dictionary with objective function symbols as the keys.
      - `method` 'Hakanen' | 'IOPIS' — The method for handling the reference point.
    - DesirableRangesOptions — Options for providing desirable ranges for an EA.
      - `name` 'preferred_ranges' — The name of the preferred ranges option.
      - `aspiration_levels` object, required — The aspiration levels as a dictionary with objective function symbols as the keys.
      - `reservation_levels` object, required — The reservation levels as a dictionary with objective function symbols as the keys.
      - `method` 'Hakanen' | 'DF transformation' — The method for handling the desirable ranges.
      - `desirability_levels` unknown[] — The desirability levels as a tuple (high, low). Used if method is DF transformation. If None, default levels (0.9, 0.1) are used.
        - unknown
    - PreferredSolutionsOptions — Options for providing preferred solutions for an EA.
      - `name` 'preferred_solutions' — The name of the preferred solutions option.
      - `preference` object, required — The preferred solutions as a dictionary with objective function symbols as the keys.
      - `method` 'Hakanen' — The method for handling the preferred solutions.
    - NonPreferredSolutionsOptions — Options for providing non-preferred solutions for an EA.
      - `name` 'non_preferred_solutions' — The name of the non-preferred solutions option.
      - `preference` object, required — The non-preferred solutions as a dictionary with objective function symbols as the keys.
      - `method` 'Hakanen' — The method for handling the non-preferred solutions.

## Response `200`

Successful Response

- EMOIterateResponse — Model of the response to an EMO iterate request.
  - `method_ids` string[], required — IDs of the EMO methods using websockets to get/send updates.
  - `client_id` string, required — Client ID to use when connecting to the websockets.
  - `state_id` integer, required — The state ID of the newly created state.

## Other responses

- `422` — Validation Error

---

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