Skip to main content

ModelCenter Custom Optimization Algorithm SDK 2026 R1

AlgorithmException Class

Last update: 19.06.2026

Namespace: Phoenix.Optimization

Overview

This exception can be thrown by an algorithm when an algorithm specific code is raised.

Inheritance

AlgorithmException

Declaration

class AlgorithmException

Description

This exception can be thrown by an algorithm when an algorithm specific code is raised.

Public Member Functions

Type Name Description
AlgorithmException (int code) Constructs AlgorithmException with a code
AlgorithmException (int code, string msg) Constructs exception with a code and message
AlgorithmException (int code, string msg, Exception inner) Constructs exception with a code, message and inner exception
override void GetObjectData (SerializationInfo info, StreamingContext context) When overridden in a derived class, sets the SerializationInfo with information about the exception.

Public Member Functions inherited from OptimizationException

Type Name Description
OptimizationException () Initializes a new instance of the OptimizationException class.
OptimizationException (string msg) Initializes a new instance of the OptimizationException class with a specified error message.
OptimizationException (string msg, Exception inner) Initializes a new instance of the OptimizationException class with a specified error message and a reference to the inner exception that is the cause of this exception.

Properties

Type Name Description
int Code [get] Gets the algorithm specific code that was raised
override string Message [get] Gets the error code and message used to create the AlgorithmException.

Constructor & Destructor Documentation

AlgorithmException()

AlgorithmException ( int code)

Constructs AlgorithmException with a code

Parameters:

  • code - Code for the exception

AlgorithmException()

AlgorithmException ( int code, string msg )

Constructs exception with a code and message

Parameters:

  • code - Code for the exception
  • msg - Message for the exception

AlgorithmException()

AlgorithmException ( int code, string msg, Exception inner )

Constructs exception with a code, message, and inner exception

Parameters:

  • code - Code for the exception
  • msg - Message for the exception
  • inner - The exception that caused the algorithm exception to be thrown.

AlgorithmException()

AlgorithmException ( SerializationInfo info, StreamingContext context )

Initializes a new instance of the AlgorithmException class with serialized data.

Parameters:

  • info - The SerializationInfo that holds the serialized object data about the exception being thrown.
  • context - The StreamingContext that contains contextual information about the source or destination.

Member Function Documentation

GetObjectData

override void `GetObjectData` ( SerializationInfo info, StreamingContext context )

When overridden in a derived class, sets the SerializationInfo with information about the exception.

Parameters:

  • info - The SerializationInfo that holds the serialized object data about the exception being thrown.
  • context - The StreamingContext that contains contextual information about the source or destination.

Code

int Code

Gets the algorithm specific code that was raised

Message

override string Message

Gets the error code and message used to create the AlgorithmException.

Property Documentation

Code

int Code

Gets the algorithm specific code that was raised

Message

override string Message

Gets the error code and message used to create the AlgorithmException.

Connect with Ansys