> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# DesignVariable Class

**Namespace:** `Phoenix.Optimization`

## Overview

Class to hold information about a design variable

## Inheritance

![DesignVariable](https://mintcdn.com/synopsys-00a47cbc/Srh1_f--TdKCLyqD/docs/modelcenter/modelcenter-custom-optimization-algorithm-sdk/api/graphics/class_phoenix_1_1_optimization_1_1_design_variable.png?fit=max\&auto=format\&n=Srh1_f--TdKCLyqD\&q=85\&s=3606d9b0efd63c2186dd831ebab503b7)

## Declaration

```csharp theme={null}
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()

```csharp theme={null}
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()

```csharp theme={null}
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 it
* `name` - string containing the name of the design variable

### DesignVariable()

```csharp theme={null}
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 it
* `name` - string containing the name of the design variable
* `startValue` - object containing the start value for the design variable

### DesignVariable()

```csharp theme={null}
DesignVariable ( DesignVariable designVariable)
```

Copy constructor for a design variable

**Parameters:**

* `designVariable` - DesignVariable containing the design variable to be copied.

### DesignVariable()

```csharp theme={null}
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 it
* `name` - string containing the name of the design variable
* `selectedAlphabet` - DataTable containing the name value pairs associated with the discrete design variable.

### DesignVariable()

```csharp theme={null}
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 it
* `name` - string containing the name of the design variable
* `startValue` - object containing the start value for the design variable
* `selectedAlphabet` - DataTable containing the name value pairs associated with the discrete design variable.

### DesignVariable()

```csharp theme={null}
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 it
* `name` - string containing the name of the design variable
* `lowerBound` - double containing the lower bound for the design variable or `NaN` if there is no lower bound.
* `upperBound` - double containing the upper bound for the design variable or `NaN` if there is no upper bound.

### DesignVariable()

```csharp theme={null}
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 it
* `name` - string containing the name of the design variable
* `startValue` - object containing the start value for the design variable.
* `lowerBound` - double containing the lower bound for the design variable or `NaN` if there is no lower bound.
* `upperBound` - double containing the upper bound for the design variable or `NaN` if there is no upper bound.

### DesignVariable()

```csharp theme={null}
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 it
* `name` - string containing the name of the design variable
* `startValue` - object containing the start value for the design variable
* `lowerBound` - double containing the lower bound for the design variable or `NaN` if there is no lower bound.
* `upperBound` - double containing the upper bound for the design variable or `NaN` if there is no upper bound.
* `selectedAlphabet` - DataTable containing the name value pairs associated with the discrete design variable.

### DesignVariable()

```csharp theme={null}
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 it
* `name` - string containing the name of the design variable
* `startValue` - object containing the start value for the design variable
* `lowerBound` - double containing the lower bound for the design variable or `NaN` if there is no lower bound.
* `upperBound` - double containing the upper bound for the design variable or `NaN` if 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

```csharp theme={null}
static double BoundFromString ( string boundText)
```

Convert bound from string to double.

**Parameters:**

* `boundText` - Bound as a string.

**Returns:**

* Bound value.

### BoundToString

```csharp theme={null}
static string BoundToString ( double bound)
```

Convert bound to string.

**Parameters:**

* `bound` - Bound value.

**Returns:**

* Bound as a string.

### CheckBounds

```csharp theme={null}
bool CheckBounds ( )
```

Check bounds

### CheckLowerBoundValue

```csharp theme={null}
bool CheckLowerBoundValue ( )
```

Check Lower bound value

### CheckMe

```csharp theme={null}
bool CheckMe ( bool doTryToFix = false)
```

Check design variable for valid state

**Parameters:**

* `doTryToFix` -

### CheckStartValue

```csharp theme={null}
bool CheckStartValue ( )
```

Check StartValue

### CheckUpperBoundValue

```csharp theme={null}
bool CheckUpperBoundValue ( )
```

Check Upper bound value

### Equals

```csharp theme={null}
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:**

* `true` if the specified DesignVariable is equal to the current DesignVariable; otherwise, `false`.

### Equals

```csharp theme={null}
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:**

* `true` if the specified Object is equal to the current Object; otherwise, `false`.

### FixValue

```csharp theme={null}
static object FixValue ( object o)
```

Fix the value in case if the value is string which can be parsed as double

**Parameters:**

* `o` -

### GetHashCode

```csharp theme={null}
override int GetHashCode ( )
```

Serves as a hash function for `DesignVariable`.

**Returns:**

* A hash code for the current `DesignVariable`.

### IsValueValid

```csharp theme={null}
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!=

```csharp theme={null}
static bool operator!= ( DesignVariable a, DesignVariable b )
```

Determines whether the specified `DesignVariable` instances are considered not equal.

**Parameters:**

* `a` - The first `DesignVariable` to compare.
* `b` - The second `DesignVariable` to compare.

**Returns:**

* `true` if the `DesignVariables` are not considered equal; otherwise, `false`.

### operator==

```csharp theme={null}
static bool operator== ( DesignVariable a, DesignVariable b )
```

Determines whether the specified `DesignVariable` instances are considered equal.

**Parameters:**

* `a` - The first `DesignVariable` to compare.
* `b` - The second `DesignVariable` to compare.

**Returns:**

* `true` if the `DesignVariables` are considered equal; otherwise, `false`.

### TryConvertToDouble

```csharp theme={null}
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

```csharp theme={null}
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

```csharp theme={null}
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

```csharp theme={null}
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

```csharp theme={null}
object BestDesignValue
```

BestDesignValueGUI

### BestDesignValueGUI

```csharp theme={null}
string BestDesignValueGUI
```

LastRunValue can be null

### BestLastDesignValueAsXmlAttr

```csharp theme={null}
string BestLastDesignValueAsXmlAttr
```

Current Model center Value (current at the moment of creating this object)

### IsDiscrete

```csharp theme={null}
bool IsDiscrete
```

Boolean stating whether or not the design variable is discrete. True when the design variable is discrete and false otherwise.

### IsMarked

```csharp theme={null}
bool IsMarked
```

Internal marker.

### LowerBound

```csharp theme={null}
double LowerBound
```

Double containing the lower bound for the design variable or `NaN` if there is no lower bound.

### LowerBoundErrText

```csharp theme={null}
string LowerBoundErrText
```

Upper Bound Error text

### LowerBoundForCheck

```csharp theme={null}
double LowerBoundForCheck
```

Get lower for checking bound

### LowerBoundGUI

```csharp theme={null}
string LowerBoundGUI
```

Set get LowerBound as text to/from GUI

### LowerBoundText

```csharp theme={null}
string LowerBoundText
```

Lower bound as a Text with localization for Nan returns appropriate Nan string

### ModelCenterValue

```csharp theme={null}
object ModelCenterValue
```

Current Model center Value (current at the moment of creating this object)

### ModelCenterValueGUI

```csharp theme={null}
string ModelCenterValueGUI
```

Gets a reference to "Index"

### Name

```csharp theme={null}
string Name
```

Name of the design variable

Implements [IVariableName]().

### NameErrText

```csharp theme={null}
string NameErrText
```

Variable name error text summary>

### SelectedAlphabet

```csharp theme={null}
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

```csharp theme={null}
object StartValue
```

Object containing the start value for the design variable

### StartValueAsDouble

```csharp theme={null}
double StartValueAsDouble
```

Returns Start value as a double if it's possible to convert startValue object to double otherwise returns NaN

### StartValueAsXmlAttr

```csharp theme={null}
string StartValueAsXmlAttr
```

Object containing the raw start value for the design variable

### StartValueBehavior

```csharp theme={null}
StartValueBehaviorEnum StartValueBehavior
```

Start Value Behavior BestDesignValue

### StartValueCalcGUI

```csharp theme={null}
object StartValueCalcGUI
```

Object containing the start value for the design variable

### StartValueErrText

```csharp theme={null}
string StartValueErrText
```

Start Value Error /Lower Bound Error text

### StartValueGUI

```csharp theme={null}
object StartValueGUI
```

Object containing the start value for the design variable

### StartValueRaw

```csharp theme={null}
object StartValueRaw
```

Object containing the raw start value for the design variable it returns string.empty for null value

### StartValueRawText

```csharp theme={null}
string StartValueRawText
```

string containing the raw start value for the design variable it returns string.empty for null value

### Uid

```csharp theme={null}
string Uid
```

String with unique identifier of the variable.

### UpperBound

```csharp theme={null}
double UpperBound
```

Double containing the upper bound for the design variable or `NaN` if there is no upper bound.

### UpperBoundErrText

```csharp theme={null}
string UpperBoundErrText
```

Type of the value

### UpperBoundForCheck

```csharp theme={null}
double UpperBoundForCheck
```

Get upper for checking bound

### UpperBoundGUI

```csharp theme={null}
string UpperBoundGUI
```

Set get UpperBound as text to/from GUI

### UpperBoundText

```csharp theme={null}
string UpperBoundText
```

Upper bound as a Text with localization for Nan returns appropriate Nan string

### ValueGUI

```csharp theme={null}
string ValueGUI
```

Value GUI if there is best design the return best design value, otherewise return modelcenter value
