Skip to main content

ModelCenter Custom Optimization Algorithm SDK 2026 R1

MockIAlgorithmCatalogEntry Class

Last update: 19.06.2026

Namespace: Phoenix.Optimization.AlgorithmTests.MockObjects

Overview

A mock implementation of IAlgorithmCatalogEntry for use in automated tests.

Inheritance

MockIAlgorithmCatalogEntry

Declaration

class MockIAlgorithmCatalogEntry

Description

A mock implementation of IAlgorithmCatalogEntry for use in automated tests.

Public Member Functions

Type Name Description
ISerializableAlgorithm DeserializeAlgorithm (string xml) Given the XML tag for an ISerializableAlgorithm, deserialize the tag and return the result.
void DeserializeAlgorithmToUserInteractionInstance (string xml) Given the XML tag for an ISerializableAlgorithm, deserialize the tag and save it in this instance's UserInteractionInstance.
void DeserializeOptionsToUserInteractionInstance (string innerXML) Given the XML tag for an options object, deserialize the tag to the IAlgorithm.Options property of UserInteractionInstance.
void Dispose ()
object GetCurrentOptionsForDialog () Returns a clone of the UserInteractionInstance IAlgorithm.Options property for use in the default options dialog. The UserInteractionInstance should be prepared to accept this object being passed as the value to set the IAlgorithm.Options property, which indicates that the user clicked "OK" and wants to set the modified version of the object.
object GetDefaultOptionsForDialog () Returns a default version of the object this algorithm uses for options.The UserInteractionInstance should be prepared to accept this object being passed as the value to set the IAlgorithm.Options property, which indicates that the user clicked "OK" and wants to set the modified version of the object.
ISerializableAlgorithm GetOutOfProcessAlgorithm () Create an out-of-process instance of the algorithm suitable for running the algorithm.Before running, the Optimization Tool will set the problem definition and options object currently in use on the UserInteractionInstance. The caller of this method owns the returned IAlgorithm and is responsible for disposing it.
MockIAlgorithmCatalogEntry (IAlgorithm algorithm) Constructor.
ISerializableAlgorithm DeserializeAlgorithm (string xml) Given the XML tag for an ISerializableAlgorithm, deserialize the tag and return the result.
void DeserializeAlgorithmToUserInteractionInstance (string xml) Given the XML tag for an ISerializableAlgorithm, deserialize the tag and save it in this instance's UserInteractionInstance.
void DeserializeOptionsToUserInteractionInstance (string innerXML) Given the XML tag for an options object, deserialize the tag to the IAlgorithm.Options property of UserInteractionInstance.
object GetCurrentOptionsForDialog () Returns a clone of the UserInteractionInstance IAlgorithm.Options property for use in the default options dialog.
object GetDefaultOptionsForDialog () Returns a default version of the object this algorithm uses for options.
ISerializableAlgorithm GetOutOfProcessAlgorithm () Create an out-of-process instance of the algorithm suitable for running the algorithm.

Protected Member Functions

Type Name Description
virtual void Setup (IAlgorithm algorithm) Initialization method used by contructors to set up the wrapped IAlgorithm.

Protected Attributes

Type Name Description
IAlgorithm _algorithm The mock IAlgorithm object.

Properties

Type Name Description
string Id [get] The ID for this algorithm entry. This is sometimes used to relocate an algorithm in the overall catalog. This property should be the same as the key associated with this entry in the dictionary returned by [IDynamicAlgorithmProvider]().LoadAlgorithms.
IAlgorithm UserInteractionInstance [get] This instance is intended for the Opt Tool to present to the user when configuring the algorithm and optimization tool. The instance is owned by the catalog entry and should be disposed when it is disposed.

Properties inherited from IAlgorithmCatalogEntry

Type Name Description
string Id [get] The ID for this algorithm entry.
IAlgorithm UserInteractionInstance [get] This instance is intended for the Opt Tool to present to the user when configuring the algorithm and optimization tool.

Constructor & Destructor Documentation

MockIAlgorithmCatalogEntry()

MockIAlgorithmCatalogEntry ( IAlgorithm algorithm)

Constructor.

Parameters:

  • algorithm - The IAlgorithm to mock wrap here (see MockAlgorithm)

Member Function Documentation

DeserializeAlgorithm

ISerializableAlgorithm DeserializeAlgorithm ( string xml)

Given the XML tag for an ISerializableAlgorithm, deserialize the tag and return the result.

Parameters:

  • xml -

Implements IAlgorithmCatalogEntry.

DeserializeAlgorithmToUserInteractionInstance

void DeserializeAlgorithmToUserInteractionInstance ( string xml)

Given the XML tag for an ISerializableAlgorithm, deserialize the tag and save it in this instance's UserInteractionInstance.

Parameters:

  • xml - The content of the XML tag.

Implements IAlgorithmCatalogEntry.

DeserializeOptionsToUserInteractionInstance

void DeserializeOptionsToUserInteractionInstance ( string innerXML)

Given the XML tag for an options object, deserialize the tag to the IAlgorithm.Options property of UserInteractionInstance.

Parameters:

  • innerXML - The content of the XML tag.

Implements IAlgorithmCatalogEntry.

GetCurrentOptionsForDialog

object GetCurrentOptionsForDialog ( )

Returns a clone of the UserInteractionInstance IAlgorithm.Options property for use in the default options dialog.The UserInteractionInstance should be prepared to accept this object being passed as the value to set the IAlgorithm.Options property, which indicates that the user clicked "OK" and wants to set the modified version of the object.

Implements IAlgorithmCatalogEntry.

GetDefaultOptionsForDialog

object GetDefaultOptionsForDialog ( )

Returns a default version of the object this algorithm uses for options. The UserInteractionInstance should be prepared to accept this object being passed as the value to set the IAlgorithm.Options property, which indicates that the user clicked "OK" and wants to set the modified version of the object.

Implements IAlgorithmCatalogEntry.

GetOutOfProcessAlgorithm

ISerializableAlgorithm GetOutOfProcessAlgorithm ( )

Create an out-of-process instance of the algorithm suitable for running the algorithm. Before running, the Optimization Tool will set the problem definition and options object currently in use on the UserInteractionInstance. The caller of this method owns the returned IAlgorithm and is responsible for disposing it.

Implements IAlgorithmCatalogEntry.

Setup

virtual void Setup ( IAlgorithm algorithm)

Initialization method used by contructors to set up the wrapped IAlgorithm.

Parameters:

  • algorithm -

Member Data Documentation

_algorithm

IAlgorithm _algorithm

The mock IAlgorithm object.

Property Documentation

Id

string Id

The ID for this algorithm entry.This is sometimes used to relocate an algorithm in the overall catalog. This property should be the same as the key associated with this entry in the dictionary returned by [IDynamicAlgorithmProvider]().LoadAlgorithms.

Implements IAlgorithmCatalogEntry.

UserInteractionInstance

IAlgorithm `UserInteractionInstance`

This instance is intended for the Opt Tool to present to the user when configuring the algorithm and optimization tool. The instance is owned by the catalog entry and should be disposed when it is disposed.

Implements IAlgorithmCatalogEntry.

Connect with Ansys