DesignVariable Class
Last update: 19.06.2026Namespace: Phoenix.Optimization
Overview
Class to hold information about a design variable
Inheritance

Declaration
class DesignVariable
Description
Class to hold information about a design variable
Public Member Functions
| Type | Name | Description |
|---|---|---|
| bool | CheckBounds () |
Check bounds |
| bool | CheckLowerBoundValue () |
Check Lower bound value |
| bool | CheckMe (bool doTryToFix=false) |
Check design variable for valid state |
| bool | CheckName (List< DesignVariable > varArr, bool isInMC) |
|
| bool | CheckStartValue () |
Check StartValue |
| bool | CheckUpperBoundValue () |
Check Upper bound value |
DesignVariable (DesignVariable designVariable) |
Copy constructor for a design variable | |
DesignVariable (string name) |
Creates a new design variable with the given name. | |
DesignVariable (string uid, string name) |
Creates a new design variable with the given id and name. | |
DesignVariable (string uid, string name, DataTable selectedAlphabet) |
Creates a new design variable with the given name, start value and selected alphabet. | |
DesignVariable (string uid, string name, double lowerBound, double upperBound) |
Creates a new design variable with the given name, start value, lower and upper bounds. | |
DesignVariable (string uid, string name, object startValue) |
Creates a new design variable with the given name and start value. | |
DesignVariable (string uid, string name, object startValue, DataTable selectedAlphabet) |
Creates a new design variable with the given name, start value and selected alphabet | |
DesignVariable (string uid, string name, object startValue, double lowerBound, double upperBound) |
Creates a new design variable with the given name, start value, lower and upper bounds. | |
DesignVariable (string uid, string name, object startValue, double lowerBound, double upperBound, DataTable selectedAlphabet) |
Creates a new design variable with the given name, start value, lower bound, upper bound and selected alphabet. | |
DesignVariable (string uid, string name, object startValue, double lowerBound, double upperBound, DataTable selectedAlphabet, DataTable alphabet) |
Creates a new design variable with the given name, start value, lower bound, upper bound, selected alphabet and alphabet. | |
| bool | Equals (DesignVariable desVar) |
Determines whether the specified DesignVariable is equal to the current DesignVariable. |
| override bool | Equals (object obj) |
Determines whether the specified Object is equal to the current Object. |
| override int | GetHashCode () |
Serves as a hash function for DesignVariable. |
Properties
| Type | Name | Description |
|---|---|---|
| DataTable | Alphabet [get, set] |
DataTable containing the full list of name value pairs for discrete design variables. |
| object | BestDesignValue [get, set] |
BestDesignValueGUI / |
| string | BestDesignValueGUI [get] |
LastRunValue can be null / |
| string | BestLastDesignValueAsXmlAttr [get, set] |
Current Model center Value (current at the moment of creating this object) / |
| int | Index [get, set] |
|
| bool | IsDiscrete [get] |
Boolean stating whether or not the design variable is discrete. |
| bool | IsMarked [get, set] |
Internal marker. |
| double | LowerBound [get, set] |
Double containing the lower bound for the design variable or NaN if there is no lower bound. |
| string | LowerBoundErrText [get] |
Upper Bound Error text / |
| double | LowerBoundForCheck [get] |
Get lower for checking bound |
| string | LowerBoundGUI [get, set] |
Set get LowerBound as text to/from GUI |
| string | LowerBoundText [get] |
Lower bound as a Text with localization for Nan returns appropriate Nan string |
| object | ModelCenterValue [get, set] |
Current Model center Value (current at the moment of creating this object) / |
| string | ModelCenterValueGUI [get] |
Gets a reference to "Index" / |
| string | Name [get, set] |
Name of the design variable |
| string | NameErrText [get] |
Variable name error text |
| DataTable | SelectedAlphabet [get, set] |
DataTable containing the name value pairs for discrete design variables. |
| object | StartValue [get] |
Object containing the start value for the design variable |
| double | StartValueAsDouble [get] |
Returns Start value as a double if it's possible to convert startValue object to double otherwise returns NaN |
| string | StartValueAsXmlAttr [get, set] |
Object containing the raw start value for the design variable |
| StartValueBehaviorEnum | StartValueBehavior [get, set] |
Start Value Behavior |
| object | StartValueCalcGUI [get] |
Object containing the start value for the design variable |
| string | StartValueErrText [get] |
Start Value Error / |
| object | StartValueGUI [get, set] |
Object containing the start value for the design variable |
| object | StartValueRaw [get, set] |
Object containing the raw start value for the design variable it returns string.empty for null value |
| string | StartValueRawText [get] |
string containing the raw start value for the design variable it returns string.empty for null value |
| string | Uid [get, set] |
String with unique identifier of the variable. |
| double | UpperBound [get, set] |
Double containing the upper bound for the design variable or NaN if there is no upper bound. |
| string | UpperBoundErrText [get] |
Type of the value / |
| double | UpperBoundForCheck [get] |
Get upper for checking bound |
| string | UpperBoundGUI [get, set] |
Set get UpperBound as text to/from GUI |
| string | UpperBoundText [get] |
Upper bound as a Text with localization for Nan returns appropriate Nan string |
| string | ValueGUI [get] |
Value GUI if there is best design the return best design value, otherewise return modelcenter value |
| Type | ValueType [get, set] |
Properties inherited from IVariableName
| Type | Name | Description |
|---|---|---|
| string | Name [get] |
The name of the variable |
Constructor & Destructor Documentation
DesignVariable()
DesignVariable ( string name)
Creates a new design variable with the given name. Assumes that the variable is continuous and that there are no bounds. The start value will be random. The uid is empty.
Parameters:
name- string containing the name of the design variable
DesignVariable()
DesignVariable ( string uid, string name )
Creates a new design variable with the given id and name. Assumes that that the variable is continuous and that there are no bounds. The start value will be random.
Parameters:
uid- uniqie identifier of the design variable allows to keep track of itname- string containing the name of the design variable
DesignVariable()
DesignVariable ( string uid, string name, object startValue )
Creates a new design variable with the given name and start value. Assumes that that the variable is continuous and that there are no bounds.
Parameters:
uid- uniqie identifier of the design variable allows to keep track of itname- string containing the name of the design variablestartValue- object containing the start value for the design variable
DesignVariable()
DesignVariable ( DesignVariable designVariable)
Copy constructor for a design variable
Parameters:
designVariable- DesignVariable containing the design variable to be copied.
DesignVariable()
DesignVariable ( string uid, string name, DataTable selectedAlphabet )
Creates a new design variable with the given name, start value and selected alphabet. The start value will be random.
Parameters:
uid- uniqie identifier of the design variable allows to keep track of itname- string containing the name of the design variableselectedAlphabet- DataTable containing the name value pairs associated with the discrete design variable.
DesignVariable()
DesignVariable ( string uid, string name, object startValue, DataTable selectedAlphabet )
Creates a new design variable with the given name, start value and selected alphabet
Parameters:
uid- uniqie identifier of the design variable allows to keep track of itname- string containing the name of the design variablestartValue- object containing the start value for the design variableselectedAlphabet- DataTable containing the name value pairs associated with the discrete design variable.
DesignVariable()
DesignVariable ( string uid, string name, double lowerBound, double upperBound )
Creates a new design variable with the given name, start value, lower and upper bounds. The start value will be random.
Parameters:
uid- uniqie identifier of the design variable allows to keep track of itname- string containing the name of the design variablelowerBound- double containing the lower bound for the design variable orNaNif there is no lower bound.upperBound- double containing the upper bound for the design variable orNaNif there is no upper bound.
DesignVariable()
DesignVariable ( string uid, string name, object startValue, double lowerBound, double upperBound )
Creates a new design variable with the given name, start value, lower and upper bounds.
Parameters:
uid- uniqie identifier of the design variable allows to keep track of itname- string containing the name of the design variablestartValue- object containing the start value for the design variable.lowerBound- double containing the lower bound for the design variable orNaNif there is no lower bound.upperBound- double containing the upper bound for the design variable orNaNif there is no upper bound.
DesignVariable()
DesignVariable ( string uid, string name, object startValue, double lowerBound, double upperBound, DataTable selectedAlphabet )
Creates a new design variable with the given name, start value, lower bound, upper bound and selected alphabet. This constructor is used internally to create design variables. Either bounds or selected alphabet should be specified, but not both.
Parameters:
uid- uniqie identifier of the design variable allows to keep track of itname- string containing the name of the design variablestartValue- object containing the start value for the design variablelowerBound- double containing the lower bound for the design variable orNaNif there is no lower bound.upperBound- double containing the upper bound for the design variable orNaNif there is no upper bound.selectedAlphabet- DataTable containing the name value pairs associated with the discrete design variable.
DesignVariable()
DesignVariable ( string uid, string name, object startValue, double lowerBound, double upperBound, DataTable selectedAlphabet, DataTable alphabet )
Creates a new design variable with the given name, start value, lower bound, upper bound, selected alphabet and alphabet. This constructor is used internally to create design variables. Either bounds or selected alphabet should be specified, but not both.
Parameters:
uid- uniqie identifier of the design variable allows to keep track of itname- string containing the name of the design variablestartValue- object containing the start value for the design variablelowerBound- double containing the lower bound for the design variable orNaNif there is no lower bound.upperBound- double containing the upper bound for the design variable orNaNif there is no upper bound.selectedAlphabet- DataTable containing the name value pairs associated with the discrete design variable.alphabet- DataTable containing the full available name value pairs for the discrete design variable.
Member Function Documentation
BoundFromString
static double BoundFromString ( string boundText)
Convert bound from string to double.
Parameters:
boundText- Bound as a string.
Returns:
- Bound value.
BoundToString
static string BoundToString ( double bound)
Convert bound to string.
Parameters:
bound- Bound value.
Returns:
- Bound as a string.
CheckBounds
bool CheckBounds ( )
Check bounds
CheckLowerBoundValue
bool CheckLowerBoundValue ( )
Check Lower bound value
CheckMe
bool CheckMe ( bool doTryToFix = false)
Check design variable for valid state
Parameters:
doTryToFix-
CheckStartValue
bool CheckStartValue ( )
Check StartValue
CheckUpperBoundValue
bool CheckUpperBoundValue ( )
Check Upper bound value
Equals
bool Equals ( DesignVariable desVar)
Determines whether the specified DesignVariable is equal to the current DesignVariable.
Parameters:
desVar- The DesignVariable object to compare with the current DesignVariable.
Returns:
trueif the specified DesignVariable is equal to the current DesignVariable; otherwise,false.
Equals
override bool Equals ( object obj)
Determines whether the specified Object is equal to the current Object.
Parameters:
obj- The object to compare with the current object.
Returns:
trueif the specified Object is equal to the current Object; otherwise,false.
FixValue
static object FixValue ( object o)
Fix the value in case if the value is string which can be parsed as double
Parameters:
o-
GetHashCode
override int GetHashCode ( )
Serves as a hash function for DesignVariable.
Returns:
- A hash code for the current
DesignVariable.
IsValueValid
static bool IsValueValid ( object value)
Return false for: "", null, NaN, "NaN". Else returns true. Note: UT for this method are under PHXSolverTest::StaticMethodTests.
Parameters:
value-
operator!=
static bool operator!= ( DesignVariable a, DesignVariable b )
Determines whether the specified DesignVariable instances are considered not equal.
Parameters:
a- The firstDesignVariableto compare.b- The secondDesignVariableto compare.
Returns:
trueif theDesignVariablesare not considered equal; otherwise,false.
operator==
static bool operator== ( DesignVariable a, DesignVariable b )
Determines whether the specified DesignVariable instances are considered equal.
Parameters:
a- The firstDesignVariableto compare.b- The secondDesignVariableto compare.
Returns:
trueif theDesignVariablesare considered equal; otherwise,false.
TryConvertToDouble
static bool TryConvertToDouble ( object o, out double valueDouble )
Fix the value in case if the value is string which can be parsed as double. Note: UT for this method are under PHXSolverTest::StaticMethodTests.
Parameters:
o-
ValueFromString
static object ValueFromString ( string valueText, Type targetType )
Convert value from string in case of double use localization if cannot convert to double then return string as it is.
Parameters:
valueText-
ValueToString
static string ValueToString ( object o)
Convert value to string in case of double use localization, return string.Empty for double Nan or Infinity
Parameters:
o-
Property Documentation
Alphabet
DataTable Alphabet
DataTable containing the full list of name value pairs for discrete design variables. The DataTable has two columns: Name and Value. The Name column contains the alias for the alphabet value and the Value column contains an object with the underlying value.
BestDesignValue
object BestDesignValue
BestDesignValueGUI
BestDesignValueGUI
string BestDesignValueGUI
LastRunValue can be null
BestLastDesignValueAsXmlAttr
string BestLastDesignValueAsXmlAttr
Current Model center Value (current at the moment of creating this object)
IsDiscrete
bool IsDiscrete
Boolean stating whether or not the design variable is discrete. True when the design variable is discrete and false otherwise.
IsMarked
bool IsMarked
Internal marker.
LowerBound
double LowerBound
Double containing the lower bound for the design variable or NaN if there is no lower bound.
LowerBoundErrText
string LowerBoundErrText
Upper Bound Error text
LowerBoundForCheck
double LowerBoundForCheck
Get lower for checking bound
LowerBoundGUI
string LowerBoundGUI
Set get LowerBound as text to/from GUI
LowerBoundText
string LowerBoundText
Lower bound as a Text with localization for Nan returns appropriate Nan string
ModelCenterValue
object ModelCenterValue
Current Model center Value (current at the moment of creating this object)
ModelCenterValueGUI
string ModelCenterValueGUI
Gets a reference to "Index"
Name
string Name
Name of the design variable
Implements IVariableName.
NameErrText
string NameErrText
Variable name error text summary>
SelectedAlphabet
DataTable SelectedAlphabet
DataTable containing the name value pairs for discrete design variables. The DataTable has two columns: Name and Value. The Name column contains the alias for the alphabet value and the Value column contains an object with the underlying value.
StartValue
object StartValue
Object containing the start value for the design variable
StartValueAsDouble
double StartValueAsDouble
Returns Start value as a double if it's possible to convert startValue object to double otherwise returns NaN
StartValueAsXmlAttr
string StartValueAsXmlAttr
Object containing the raw start value for the design variable
StartValueBehavior
StartValueBehaviorEnum StartValueBehavior
Start Value Behavior BestDesignValue
StartValueCalcGUI
object StartValueCalcGUI
Object containing the start value for the design variable
StartValueErrText
string StartValueErrText
Start Value Error /Lower Bound Error text
StartValueGUI
object StartValueGUI
Object containing the start value for the design variable
StartValueRaw
object StartValueRaw
Object containing the raw start value for the design variable it returns string.empty for null value
StartValueRawText
string StartValueRawText
string containing the raw start value for the design variable it returns string.empty for null value
Uid
string Uid
String with unique identifier of the variable.
UpperBound
double UpperBound
Double containing the upper bound for the design variable or NaN if there is no upper bound.
UpperBoundErrText
string UpperBoundErrText
Type of the value
UpperBoundForCheck
double UpperBoundForCheck
Get upper for checking bound
UpperBoundGUI
string UpperBoundGUI
Set get UpperBound as text to/from GUI
UpperBoundText
string UpperBoundText
Upper bound as a Text with localization for Nan returns appropriate Nan string
ValueGUI
string ValueGUI
Value GUI if there is best design the return best design value, otherewise return modelcenter value