AlgorithmTestFixture Class
Last update: 19.06.2026Namespace: Phoenix.Optimization.AlgorithmTests
Overview
Abstract class used for implementing basic algorithm tests.
Declaration
class AlgorithmTestFixtureabstract
Description
Abstract class used for implementing basic algorithm tests.
Classes
| Type | Name | Description |
|---|---|---|
| struct | AlgorithmResults |
Public Member Functions
| Type | Name | Description |
|---|---|---|
| void | authorDoesDoesNotThrowExceptionAndIsNotEmpty () |
Test to verify that the Author property does not throw an exception and is defined. |
| void | canMaximize () |
Test to verify that the algorithm can solve a problem definition with a maximize objective. |
| void | canMinimize () |
Test to verify that the algorithm can solve a problem definition with a minimize objective. |
| abstract void | createAlgorithm () |
Creates instance of algorithm to be tested and assigns it to the algorithm variable |
| void | definesGUID () |
Test to verify that the algorithm had a GUID. |
| void | descriptionDoesDoesNotThrowExceptionAndIsNotEmpty () |
Test to verify that the Description property does not throw an exception and is defined. |
| void | detailsReportDoesNotThrowExceptionAndIsNotEmptyAfterRun () |
Verifies the P:Phoenix.Optimization.IAlgorithm.DetailsReport property does not throw an exception and is not empty after the algorithm is run. |
| void | detailsReportDoesNotThrowExceptionBeforeRun () |
Verifies the P:Phoenix.Optimization.IAlgorithm.DetailsReport property does not throw an exception before the algorithm is run. |
| void | detailsReportUpdateDuringRun () |
Verifies that the algorithm updates the DetailsReport during the run. |
| virtual void | doesAlgorithmLoadProperly () |
Test to verify that the algorithm has been copied to a location where the Optimization Tool can find it and that the Optimization Tool is able to load it. |
| void | doesIsDesignFeasibileThrowError () |
Tests whether or not the algorithm's IsDesignFeasible method throws an error, or says that a global best design is not feasible. |
| void | efficiencyDoesDoesNotThrowExceptionAndIsSpecified () |
Test to verify that the NumModelEvaluations does not throw an exception and is not AlgorithmNumModelEvaluations.Unspecified. |
| void | handlesFailedRuns () |
Test to verify that the algorithm that says that it can support failed runs is able to solve problem that has failed runs. |
| void | handlesNaNInConstraints () |
Tests whether the algorithm can handle NaN passed as an upper or lower bound for constraints. |
| void | handlesNaNInDesignVariables () |
Tests whether the algorithm can handle NaN passed as an upper or lower bound for design variables. |
| void | handlesNoFeasibleRunsFound (Exception expectedException) |
Verify that an algorithm handles the case of no feasible points being found and throws the expected exception. |
| virtual void | handlesUnicodeEnums () |
Test to verify that the algorithm can handle Unicode characters in discrete variable enumerations. |
| void | handlesUnicodeNames () |
Test to verify that the algorithm can handle Unicode characters in variable names. |
| void | helpFilePathDoesDoesNotThrowExceptionAndFileExists () |
Test to verify that the HelpFilePath property does not throw an exception, is defined and that the file exists. |
| void | helpURLDoesDoesNotThrowExceptionAndIsNotEmpty () |
Test to verify that the HelpURL property does not throw an exception and is defined. |
| void | iconLocationDoesDoesNotThrowExceptionAndFileExists () |
Test to verify that the IconLocation property does not throw an exception, is defined and that the file exists. |
| void | keywordsDoesDoesNotThrowExceptionAndIsNotEmpty () |
Test to verify that the Keywords property does not throw an exception and is defined. |
| void | licenseFeatureDoesDoesNotThrowException () |
Test to verify that the HelpFilePath property does not throw an exception. |
| bool | lohPapalambrosFunctionTest () |
Runs the algorithm using the T:Phoenix.Optimization.AlgorithmTests.Evaluators.LohPapalambrosExample2Evaluator. |
| bool | matyasFunctionTest () |
Runs the algorithm using the T:Phoenix.Optimization.AlgorithmTests.Evaluators.MatyasEvaluator. |
| void | maxNumberOfObjectivesDoesDoesNotThrowExceptionAndIsGreaterThanZero () |
Test to verify that the MaxNumberOfObjectives does not throw an exception and is greater than zero. |
| void | nameDoesDoesNotThrowExceptionAndIsNotEmpty () |
Test to verify that the Name property does not throw an exception and is defined. |
| void | optionsDoesDoesNotThrowException () |
Test to verify that calling the Options property does not throw an exception. |
| void | optionsGetSetCorrectly () |
Test to determine whether or not options work correctly. |
| void | optionsIsSerializable () |
Test to verify that algorithm Options are serializable. |
| void | optionsSerializeDeserializeCorrectly () |
Test to verify that the algorithm P:Phoenix.Optimization.IAlgorithm.Options can be serialized, and that they are the same as the original options when they are deserialized. |
| void | releaseDateDoesDoesNotThrowExceptionAndIsInRightFormat () |
Test to verify that the ReleaseDate property does not throw an exception, is defined and is in the correct format. |
| void | respectsHalt () |
Tests whether the algorithm halts in a timely matter when the Phoenix.Optimization.IAlgorithmHost.Halt property is set. |
| virtual void | restartWorksCorrectly_RestoreFromEnd () |
Test to verify that the algorithm sets at least one check point during a run, and is able to find the same answer using that check point as by using a full run when restored from the end. |
| virtual void | restartWorksCorrectly_RestoreFromMiddle () |
Test to verify that the algorithm sets at least one check point during a run, and is able to find the same answer using that check point as by using a full run when restored from the middle. |
| virtual void | restartWorksCorrectly_RestoreFromStart () |
Test to verify that the algorithm sets at least one check point during a run, and is able to find the same answer using that check point as by using a full run when restored from the start. |
| void | resultsReportDoesNotThrowExceptionAndIsNotEmptyAfterRun () |
Test to verify that P:Phoenix.Optimization.IAlgorithm.ResultsReport does not throw an exception and is not empty after the algorithm has been run. |
| void | resultsReportDoesNotThrowExceptionBeforeRun () |
Test to verify that calling P:Phoenix.Optimization.IAlgorithm.ResultsReport before the algorithm has been run does not throw an exception. |
| void | setConstraintsDoesNotThrowException () |
Test to verify that setting constraints does not throw an exception. |
| void | setDesignVariablesDoesNotThrowException () |
Test to verify that setting design variables does not throw an exception. |
| void | setDetailsFile () |
|
| void | setObjectivesDoesNotThrowException () |
Test to verify that setting algorithm objectives does not throw an exception. |
| virtual void | setOptionsForFrankFunctionTest () |
Sets algorithm's options to be used for the Frank function. |
| virtual void | setOptionsForLohPapalambrosFunctionTest () |
Sets algorithm's options to be used for the Matyas function. |
| virtual void | setOptionsForMatyasFunctionTest () |
Sets algorithm's options to be used for the Matyas function. |
| virtual void | setOptionsForNonConvergingFunctionTest () |
Sets algorithm's options to be used for the Non-converging function. |
| virtual void | setOptionsForRestartTest () |
Sets algorithm's options to be used for the restart test. |
| virtual void | setOptionsForSystemTest () |
Sets algorithm's options to be used for the System test. |
| void | Setup () |
Test set up called before each test is Run. |
| void | supportsConstraintsDoesDoesNotThrowExceptionAndIsSpecified () |
Test to verify that the SupportsConstraints does not throw an exception and is not FuzzyBoolean.Unspecified. |
| void | supportsDiscreteVariablesDoesDoesNotThrowExceptionAndIsSpecified () |
Test to verify that the SupportsDiscreteVariables does not throw an exception and is not FuzzyBoolean.Unspecified. |
| void | supportsFailedRunsDoesDoesNotThrowException () |
Test to verify that the SupportsFailedRuns does not throw an exception. |
| void | supportsMinMaxDoesDoesNotThrowExceptionAndIsSpecified () |
Test to verify that the SupportsMinMax does not throw an exception and is not FuzzyBoolean.Unspecified. |
| void | supportsMultipleObjectivesDoesDoesNotThrowExceptionAndMaxNumObjectivesIsConsistent () |
Test to verify that the SupportsMultipleObjectives does not throw an exception and is consistent with the P:Phoenix.Optimization.IAlgorithm.MaxNumberOfObjectives property. |
| void | supportsNonSmoothConstraintsDoesDoesNotThrowExceptionAndIsSpecified () |
Test to verify that the SupportsNonSmoothResponses does not throw an exception and is not FuzzyBoolean.Unspecified. |
| void | supportsSolveForDoesDoesNotThrowExceptionAndIsSpecified () |
Test to verify that the SupportsSolveFor property is does not throw an exception when called and is not FuzzyBoolean.Unspecified. |
| void | TearDown () |
Test tear down called after each test is Run. |
| void | tearDown () |
Called after each test to clean up after test. |
| void | versionDoesDoesNotThrowExceptionAndIsNotEmpty () |
Test to verify that the Version property does not throw an exception and is defined. |
Static Public Member Functions
| Type | Name | Description |
|---|---|---|
| static bool | areDesignsEqual (object[] design1, object[] design2, IEvaluator evaluator) |
Used to determine whether two designs are equal. |
| static void | optionsAreEqual (object lhs, object rhs) |
Checks whether given options objects properties are equal. |
static MockSolverInfrastructure |
testWithEvaluator (ref IAlgorithm algorithm, IEvaluator evaluator, ref bool finishedSuccessfully, Action< MockSolverInfrastructure > setupSolver=null) |
Tests algorithm with the specified evaluator. |
Protected Types
| Type | Name | Description |
|---|---|---|
| enum | CheckpointLocation { Start , Middle , End } |
Protected Member Functions
| Type | Name | Description |
|---|---|---|
| virtual void | _cleanUp () |
Allows each implementing test fixture to perform additional cleanup during tear down |
| void | _createAlgorithm () |
|
| void | optionsAreNotEqual (object lhs, object rhs) |
Checks whether all properties of given options objects are not equal. |
| string | pickCheckpoint (Dictionary< int, string > checkPoints, int checkPointIndex, out int runNumber) |
Gets the checkpoint string from the desired position in the list, and returns it and its run number. |
| void | recordResults (ref AlgorithmResults runResults, MockSolverInfrastructure solver, IAlgorithm algorithm) |
|
| bool | runAlgorithm (bool useRosenbrock=false, Action< MockSolverInfrastructure > setupSolver=null) |
Runs the algorithm & performs some basic tests on the results. |
| double | runRosenBrock (ref AlgorithmResults results, string checkPoint="") |
Helper function that runs RosenBrock with default options either resuming or running a new one. |
| virtual void | verifyResultsAreEqual (AlgorithmResults fullRunResults, AlgorithmResults restartResults, int restoreRunNumber) |
Verifies that the results of two runs are the same. |
Protected Attributes
| Type | Name | Description |
|---|---|---|
IAlgorithm |
algorithm = null |
Instance of algorithm to be tested |
MockSolverInfrastructure |
solver = null |
Instance of MockSolverInfrastructure used for tests |
Properties
| Type | Name | Description |
|---|---|---|
| abstract string | AlgorithmInstallationPath [get] |
Returns the path to the installed algorithm |
| virtual bool | HasOptions [get] |
Specifies whether or not the algorithm has options. |
| virtual int | NumberOfMessagesBeforeRestartSync [get] |
Offset for the number of status messages before messages are the same after a restart. |
Class Documentation
AlgorithmResults
Public Attributes
- PHXDesign:
BestDesign - List< PHXDesign >:
BestDesigns - Dictionary< int, string >:
CheckPoints - string :
ExceptionString - bool:
FinishedSuccessfully - List< ModelEvaluation >:
ModelEvaluations - string:
ResultsReport - DataTable:
StatusMessages - bool:
ThrewException
Member Function Documentation
_cleanUp
virtual void _cleanUp ( )
Allows each implementing test fixture to perform additional cleanup during tear down.
areDesignsEqual
static bool `areDesignsEqual` ( object[] design1, object[] design2, IEvaluator evaluator )
Used to determine whether two designs are equal.
Parameters:
design1- object array containing the first design to be compared.design2- object array containing the second design to be compared.evaluator-T:Phoenix.Optimization.IEvaluatorused for function evaluations.
Returns:
- Returns
trueif the algorithm considers the two designs to be equivalent, andfalseotherwise
authorDoesDoesNotThrowExceptionAndIsNotEmpty
void authorDoesDoesNotThrowExceptionAndIsNotEmpty ( )
Test to verify that the Author property does not throw an exception and is defined.
canMaximize
void canMaximize ( )
Test to verify that the algorithm can solve a problem definition with a maximize objective. If the algorithm does not support Minimize/Maximize objectives (i.e. SupportsMinMax is FuzzyBoolean.False), then this test is ignored.
canMinimize
void canMinimize ( )
Test to verify that the algorithm can solve a problem definition with a minimize objective. If the algorithm does not support Minimize/Maximize objectives (i.e. SupportsMinMax is FuzzyBoolean.False), then this test is ignored.
createAlgorithm
abstract void createAlgorithm ( )
Creates instance of algorithm to be tested and assigns it to the algorithm variable
definesGUID
void definesGUID ( )
Test to verify that the algorithm had a GUID.
descriptionDoesDoesNotThrowExceptionAndIsNotEmpty
void descriptionDoesDoesNotThrowExceptionAndIsNotEmpty ( )
Test to verify that the Description property does not throw an exception and is defined.
detailsReportDoesNotThrowExceptionAndIsNotEmptyAfterRun
void detailsReportDoesNotThrowExceptionAndIsNotEmptyAfterRun ( )
Verifies the P:Phoenix.Optimization.IAlgorithm.DetailsReport property does not throw an exception and is not empty after the algorithm is run.
detailsReportDoesNotThrowExceptionBeforeRun
void detailsReportDoesNotThrowExceptionBeforeRun ( )
Verifies the P:Phoenix.Optimization.IAlgorithm.DetailsReport property does not throw an exception before the algorithm is run.
detailsReportUpdateDuringRun
void detailsReportUpdateDuringRun ( )
Verifies that the algorithm updates the DetailsReport during the run.
doesAlgorithmLoadProperly
virtual void doesAlgorithmLoadProperly ( )
Test to verify that the algorithm has been copied to a location where the Optimization Tool can find it and that the Optimization Tool is able to load it. This test is useful for verifying that all dependencies are known and copied to the install directory.
doesIsDesignFeasibileThrowError
void doesIsDesignFeasibileThrowError ( )
Tests whether or not the algorithm's IsDesignFeasible method throws an error, or says that a global best design is not feasible.
efficiencyDoesDoesNotThrowExceptionAndIsSpecified
void efficiencyDoesDoesNotThrowExceptionAndIsSpecified ( )
Test to verify that the NumModelEvaluations does not throw an exception and is not AlgorithmNumModelEvaluations.Unspecified.
handlesFailedRuns
void handlesFailedRuns ( )
Test to verify that the algorithm that says that it can support failed runs is able to solve problem that has failed runs. If the algorithm does not support failed runs (i.e. SupportsFailedRuns is false), then this test is ignored.
handlesNaNInConstraints
void handlesNaNInConstraints ( )
Tests whether the algorithm can handle NaN passed as an upper or lower bound for constraints. If the algorithm does not support an open bound for constraints, it should throw BoundsMustBeSpecifiedException. Other Exceptions will be marked as Inconclusive.
handlesNaNInDesignVariables
void handlesNaNInDesignVariables ( )
Tests whether the algorithm can handle NaN passed as an upper or lower bound for design variables. If the algorithm does not support an open bound for constraints, it should throw BoundsMustBeSpecifiedException. Other Exceptions will be marked as Inconclusive.
handlesNoFeasibleRunsFound
void handlesNoFeasibleRunsFound ( Exception expectedException)
Verify that an algorithm handles the case of no feasible points being found and throws the expected exception.
Parameters:
expectedException- the exception we expect to be thrown when no feasible points are found
handlesUnicodeEnums
virtual void handlesUnicodeEnums ( )
Test to verify that the algorithm can handle Unicode characters in discrete variable enumerations.
handlesUnicodeNames
void handlesUnicodeNames ( )
Test to verify that the algorithm can handle Unicode characters in variable names.
helpFilePathDoesDoesNotThrowExceptionAndFileExists
void helpFilePathDoesDoesNotThrowExceptionAndFileExists ( )
Test to verify that the HelpFilePath property does not throw an exception, is defined, and that the file exists.
helpURLDoesDoesNotThrowExceptionAndIsNotEmpty
void helpURLDoesDoesNotThrowExceptionAndIsNotEmpty ( )
Test to verify that the HelpURL property does not throw an exception and is defined.
iconLocationDoesDoesNotThrowExceptionAndFileExists
void iconLocationDoesDoesNotThrowExceptionAndFileExists ( )
Test to verify that the IconLocation property does not throw an exception, is defined and that the file exists.
keywordsDoesDoesNotThrowExceptionAndIsNotEmpty
void keywordsDoesDoesNotThrowExceptionAndIsNotEmpty ( )
Test to verify that the Keywords property does not throw an exception and is defined.
licenseFeatureDoesDoesNotThrowException
void licenseFeatureDoesDoesNotThrowException ( )
Test to verify that the HelpFilePath property does not throw an exception. The license feature only needs to be defined if the algorithm will be licensed through Phoenix.
lohPapalambrosFunctionTest
bool lohPapalambrosFunctionTest ( )
Runs the algorithm using the T:Phoenix.Optimization.AlgorithmTests.Evaluators.LohPapalambrosExample2Evaluator.
Returns:
Trueif the algorithm was able to find a local minima,falseotherwise.
matyasFunctionTest
bool matyasFunctionTest ( )
Runs the algorithm using the T:Phoenix.Optimization.AlgorithmTests.Evaluators.MatyasEvaluator.
Returns:
Trueif the algorithm was able to find a local minima,falseotherwise.
maxNumberOfObjectivesDoesDoesNotThrowExceptionAndIsGreaterThanZero
void maxNumberOfObjectivesDoesDoesNotThrowExceptionAndIsGreaterThanZero ( )
Test to verify that the MaxNumberOfObjectives does not throw an exception and is greater than zero.
nameDoesDoesNotThrowExceptionAndIsNotEmpty
void nameDoesDoesNotThrowExceptionAndIsNotEmpty ( )
Test to verify that the Name property does not throw an exception and is defined.
optionsAreEqual
static void optionsAreEqual ( object lhs, object rhs )
Checks whether given options objects properties are equal. Objects must point to different references.
Parameters:
lhs- First options object.rhs- Second options object.
optionsAreNotEqual
void optionsAreNotEqual ( object lhs, object rhs )
Checks whether all properties of given options objects are not equal. Objects must point to different references.
Parameters:
lhs- First options object.rhs- Second options object.
optionsDoesDoesNotThrowException
void optionsDoesDoesNotThrowException ( )
Test to verify that calling the Options property does not throw an exception.
optionsGetSetCorrectly
void optionsGetSetCorrectly ( )
Test to determine whether or not options work correctly. This test gets the options from the algorithm, shuffles their values, passes them back to the algorithm then reads them again. If the options are different when read back, the test fails. If the algorithm does not have any options the P:Phoenix.Optimization.AlgorithmTests.AlgorithmTestFixture.HasOptions property should be overridden to return false.
optionsIsSerializable
void optionsIsSerializable ( )
Test to verify that algorithm Options are serializable. If the algorithm does not have any options the P:Phoenix.Optimization.AlgorithmTests.AlgorithmTestFixture.HasOptions property should be overridden to return false.
optionsSerializeDeserializeCorrectly
void optionsSerializeDeserializeCorrectly ( )
Test to verify that the algorithm P:Phoenix.Optimization.IAlgorithm.Options can be serialized, and that they are the same as the original options when they are deserialized. Ignoring for the same reason as optionsGetSetCorrectly(). If the algorithm does not have any options the P:Phoenix.Optimization.AlgorithmTests.AlgorithmTestFixture.HasOptions property should be overridden to return false.
pickCheckpoint
string pickCheckpoint ( Dictionary< int, string > checkPoints, int checkPointIndex, out int runNumber )
Gets the checkpoint string from the desired position in the list, and returns it and its run number.
Parameters:
checkPoints- The list of checkpoints to pick from.checkPointIndex- The index of the checkpoint to pick.runNumber- Storage for the returned run number.
releaseDateDoesDoesNotThrowExceptionAndIsInRightFormat
void releaseDateDoesDoesNotThrowExceptionAndIsInRightFormat ( )
Test to verify that the ReleaseDate property does not throw an exception, is defined, and is in the correct format.
respectsHalt
void respectsHalt ( )
Tests whether the algorithm halts in a timely matter when the Phoenix.Optimization.IAlgorithmHost.Halt property is set. It is recommended that the algorithm check the P:Phoenix.Optimization.IAlgorithmHost.Halt property before each M:Phoenix.Optimization.IAlgorithmHost.EvaluateModel(System.Object[]) or M:Phoenix.Optimization.IAlgorithmHost.UpdateBestDesign(System.Object[]) call.
restartWorksCorrectly_RestoreFromEnd
virtual void restartWorksCorrectly_RestoreFromEnd ( )
Test to verify that the algorithm sets at least one check point during a run, and is able to find the same answer using that check point as by using a full run when restored from the end.
restartWorksCorrectly_RestoreFromMiddle
virtual void restartWorksCorrectly_RestoreFromMiddle ( )
Test to verify that the algorithm sets at least one check point during a run, and is able to find the same answer using that check point as by using a full run when restored from the middle.
restartWorksCorrectly_RestoreFromStart
virtual void restartWorksCorrectly_RestoreFromStart ( )
Test to verify that the algorithm sets at least one check point during a run, and is able to find the same answer using that check point as by using a full run when restored from the start.
resultsReportDoesNotThrowExceptionAndIsNotEmptyAfterRun
void resultsReportDoesNotThrowExceptionAndIsNotEmptyAfterRun ( )
Test to verify that
P:Phoenix.Optimization.IAlgorithm.ResultsReport does not throw an exception and is not empty after the algorithm has been run.
resultsReportDoesNotThrowExceptionBeforeRun
void resultsReportDoesNotThrowExceptionBeforeRun ( )
Test to verify that calling P:Phoenix.Optimization.IAlgorithm.ResultsReport before the algorithm has been run does not throw an exception.
runAlgorithm
bool runAlgorithm ( bool useRosenbrock = false, Action< MockSolverInfrastructure > setupSolver = null )
Runs the algorithm & performs some basic tests on the results.
Parameters:
useRosenbrock- Whether to run the algorithm with the Rosenbrock evaluatorsetupSolver- Optional callback to enable the caller to set up theMockSolverIntrastructureinstance that this method creates & uses
Returns:
- flag indicating whether the algorithm finished successfully
runRosenBrock
double runRosenBrock ( ref AlgorithmResults results, string checkPoint = "" )
Helper function that runs RosenBrock with default options either resuming or running a new one.
Parameters:
results- ref AlgorithmResults objectcheckPoint- optional checkpoint string to be restored for resuming
Returns:
- best design objective for this run
setConstraintsDoesNotThrowException
void setConstraintsDoesNotThrowException ( )
Test to verify that setting constraints does not throw an exception.
setDesignVariablesDoesNotThrowException
void setDesignVariablesDoesNotThrowException ( )
Test to verify that setting design variables does not throw an exception.
setObjectivesDoesNotThrowException
void setObjectivesDoesNotThrowException ( )
Test to verify that setting algorithm objectives does not throw an exception.
setOptionsForFrankFunctionTest
virtual void setOptionsForFrankFunctionTest ( )
Sets algorithm's options to be used for the Frank function. If not implemented, the default options are used.
setOptionsForLohPapalambrosFunctionTest
virtual void setOptionsForLohPapalambrosFunctionTest ( )
Sets algorithm's options to be used for the Matyas function. If not implemented, the default options are used.
setOptionsForMatyasFunctionTest
virtual void setOptionsForMatyasFunctionTest ( )
Sets algorithm's options to be used for the Matyas function. If not implemented, the default options are used.
setOptionsForNonConvergingFunctionTest
virtual void setOptionsForNonConvergingFunctionTest ( )
Sets algorithm's options to be used for the Non-converging function. If not implemented, the default options are used.
setOptionsForRestartTest
virtual void setOptionsForRestartTest ( )
Sets algorithm's options to be used for the restart test. If not implemented, the default options are used.
setOptionsForSystemTest
virtual void setOptionsForSystemTest ( )
Sets algorithm's options to be used for the System test. If not implemented, the default options are used.
Setup
void Setup ( )
Test set up called before each test is Run. Creates new instance of MockSolver, sets the host callback, calls createAlgorithm, and sets the host interface for the algorithm.
supportsConstraintsDoesDoesNotThrowExceptionAndIsSpecified
void supportsConstraintsDoesDoesNotThrowExceptionAndIsSpecified ( )
Test to verify that the SupportsConstraints does not throw an exception and is not FuzzyBoolean.Unspecified.
supportsDiscreteVariablesDoesDoesNotThrowExceptionAndIsSpecified
void supportsDiscreteVariablesDoesDoesNotThrowExceptionAndIsSpecified ( )
Test to verify that the SupportsDiscreteVariables does not throw an exception and is not FuzzyBoolean.Unspecified.
supportsFailedRunsDoesDoesNotThrowException
void supportsFailedRunsDoesDoesNotThrowException ( )
Test to verify that the SupportsFailedRuns does not throw an exception.
supportsMinMaxDoesDoesNotThrowExceptionAndIsSpecified
void supportsMinMaxDoesDoesNotThrowExceptionAndIsSpecified ( )
Test to verify that the SupportsMinMax does not throw an exception and is not FuzzyBoolean.Unspecified.
supportsMultipleObjectivesDoesDoesNotThrowExceptionAndMaxNumObjectivesIsConsistent
void supportsMultipleObjectivesDoesDoesNotThrowExceptionAndMaxNumObjectivesIsConsistent ( )
Test to verify that the SupportsMultipleObjectives does not throw an exception and is consistent with the P:Phoenix.Optimization.IAlgorithm.MaxNumberOfObjectives property.
supportsNonSmoothConstraintsDoesDoesNotThrowExceptionAndIsSpecified
void supportsNonSmoothConstraintsDoesDoesNotThrowExceptionAndIsSpecified ( )
Test to verify that the SupportsNonSmoothResponses does not throw an exception and is not FuzzyBoolean.Unspecified.
supportsSolveForDoesDoesNotThrowExceptionAndIsSpecified
void supportsSolveForDoesDoesNotThrowExceptionAndIsSpecified ( )
Test to verify that the SupportsSolveFor property is does not throw an exception when called and is not FuzzyBoolean.Unspecified.
TearDown
void TearDown ( )
Test tear down called after each test is Run. Disposes of the algorithm.
tearDown
void tearDown ( )
Called after each test to clean up after test. Deletes test's references to algorithm and host.
testWithEvaluator
static MockSolverInfrastructure testWithEvaluator ( ref [IAlgorithm](Namespaces/NamespaceList/Phoenix/Optimization/IAlgorithm) algorithm, [IEvaluator](Namespaces/NamespaceList/Phoenix/Optimization/IEvaluator) evaluator, ref bool finishedSuccessfully, Action< MockSolverInfrastructure > setupSolver = null )
Tests algorithm with the specified evaluator. If evaluator is not appropriate for the algoritm (i.e. evaluator uses solve for, but algorithm does not support solve for), the test is ignored.
Parameters:
algorithm-T:Phoenix.Optimization.IAlgorithmto be used.evaluator-T:Phoenix.Optimization.IEvaluatorto be used for algorithm testfinishedSuccessfully- Used to return whether or not the algorithm finished successfullysetupSolver- Optional callback to enable the caller to set up theMockSolverIntrastructureinstance that this method creates & uses
Returns:
T:Phoenix.Optimization.AlgorithmTests.MockObjects.MockSolverInfrastructureused
verifyResultsAreEqual
virtual void verifyResultsAreEqual ( AlgorithmResults fullRunResults, AlgorithmResults restartResults, int restoreRunNumber )
Veifies that the results of two runs are the same. If not implemented in the specific tests, uses the simple check implemented here.
Parameters:
fullRunResults- The results of the first run.restartResults- The results of the restored run.
versionDoesDoesNotThrowExceptionAndIsNotEmpty
void versionDoesDoesNotThrowExceptionAndIsNotEmpty ( )
Test to verify that the Version property does not throw an exception and is defined.
algorithm
IAlgorithm algorithm = null
Instance of algorithm to be tested
solver
MockSolverInfrastructure solver = null
Instance of MockSolverInfrastructure used for tests
Property Documentation
AlgorithmInstallationPath
abstract string AlgorithmInstallationPath
Returns the path to the installed algorithm
HasOptions
virtual bool HasOptions
Specifies whether or not the algorithm has options. By default, the test suite assumes that the algorithm has options. If the algorithm does not have options, this property can be implmented to return false so that the options tests will be ignored.
NumberOfMessagesBeforeRestartSync
virtual int NumberOfMessagesBeforeRestartSync
Offset for the number of status messages before messages are the same after a restart. This property is used by M:Phoenix.Optimization.AlgorithmTests.AlgorithmTestFixture.restartWorksCorrectly. The algorithm may have status messages that inform the user that a saved state is being restored, and this property is overridden to take that into account.