> ## 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.

# Objective Class

**Namespace:** `Phoenix.Optimization`

## Overview

Class to hold information about an objective

## Inheritance

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

## Declaration

```csharp theme={null}
class Objective
```

## Description

Class to hold information about an objective

## Public Member Functions

| Type | Name | Description |
| - | - | - |
| int | `Compare (double x, double y)` | Compares two points with respect to the objective. |
| Objective | `ConvertSolverForToMinMax ()` | If this objective is a solvefor value, returns a new equivalent objective using an equation and minimize. |
| override bool | `Equals (object obj)` | Determines whether the specified Object is equal to the current Object. |
| bool | `Equals (Objective obj)` | Determines whether the specified Objective is equal to the current Objective. |
| override int | `GetHashCode ()` | Serves as a hash function for Objective. |
| | `Objective (Objective objective)` | Copy constructor |
| | `Objective (string name, double solveForValue)` | Creates a new objective with the given name and solve for value |
| | `Objective (string name, double solveForValue, double weight)` | Creates a new objective with the given name, solve for value and weight. |
| | `Objective (string name, Goal goal)` | Creates a new objective with the given name and goal. |
| | `Objective (string name, Goal goal, double weight)` | Creates a new objective with the given name, goal and weight. |
| | `Objective (string name, Goal goal, double weight, double solveForValue)` | Creates a new objective with the given name, goal, weight and solve for value. |

## Properties

| Type | Name | Description |
| - | - | - |
| Goal | `Goal [get]` | Goal containing the goal of the objeictive. |
| string | `Name [get]` | String containing the name of the objective. |
| double | `SolveForValue [get]` | Double containing the value to be solved for for the `Goal.SolveFor` goal. |
| double | `Weight [get]` | Goal containing the relative weight of the objective. |

### Properties inherited from [IVariableName]()

| Type | Name | Description |
| - | - | - |
| string | `Name [get]` | The name of the variable |

## Constructor & Destructor Documentation

### Objective()

```csharp theme={null}
Objective ( string name, Goal goal )
```

Creates a new objective with the given name and goal. Assumes that the weight of the objective should be 1.0.

**Parameters:**

* `name` - string containing the name of the objective.
* `goal` - Goal containing the goal of the objective.

### Objective()

```csharp theme={null}
Objective ( Objective objective)
```

Copy constructor

**Parameters:**

* `objective` - Objective to be copied

### Objective()

```csharp theme={null}
Objective ( string name, double solveForValue )
```

Creates a new objective with the given name and solve for value

**Parameters:**

* `name` - string containing the name of the objective.
* `solveForValue` - double containing the solve for value for the objective.

### Objective()

```csharp theme={null}
Objective ( string name, double solveForValue, double weight )
```

Creates a new objective with the given name, solve for value and weight. Assumes a goal of `Goal.SolveFor`.

**Parameters:**

* `name` - string containing the name of the objective.
* `solveForValue` - double containing the solve for value for the objective.
* `weight` - double containing the relative weight for the objective.

### Objective()

```csharp theme={null}
Objective ( string name, Goal goal, double weight )
```

Creates a new objective with the given name, goal and weight.

**Parameters:**

* `name` - string containing the name of the objective.
* `goal` - Goal containing the goal of the objective.
* `weight` - double containing the relative weight for the objective.

### Objective()

```csharp theme={null}
Objective ( string name, Goal goal, double weight, double solveForValue )
```

Creates a new objective with the given name, goal, weight and solve for value.

**Parameters:**

* `name` - string containing the name of the objective.
* `goal` - Goal containing the goal of the objective.
* `weight` - double containing the relative weight for the objective.
* `solveForValue` - double containing the solve for value for the objective.

## Member Function Documentation

### Compare

```csharp theme={null}
int Compare ( double x, double y )
```

Compares two points with respect to the objective.

**Parameters:**

* `x` - Test value 1
* `y` - Test value 2

**Returns:**

* `-1` if `x` is better w/r/t the goal. `0` if they are the same w/r/t goal. `1` if `y` is better

### ConvertSolverForToMinMax

```csharp theme={null}
Objective ConvertSolverForToMinMax ( )
```

If this objective is a `solvefor` value, returns a new equivalent objective using an equation and minimize. Otherwise just returns self.

**Returns:**

* Converted objective

### ConvertToSingleObjective

```csharp theme={null}
static Objective ConvertToSingleObjective ( List< Objective > objectives)
```

Takes a list of objectives and collapses them down into a single objective using the weights.

**Parameters:**

* `objectives` - A list of objectives

**Returns:**

* A new collapsed Objective, or null if the list is empty

### 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`.

### Equals

```csharp theme={null}
bool Equals ( Objective obj)
```

Determines whether the specified Objective is equal to the current Objective.

**Parameters:**

* `obj` - The Objective object to compare with the current Objective.

**Returns:**

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

### GetHashCode

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

Serves as a hash function for Objective.

**Returns:**

* A hash code for the current Objective.

### operator!=

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

Determines whether the specified Objective instances are considered not equal.

**Parameters:**

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

**Returns:**

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

### operator==

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

Determines whether the specified Objective instances are considered equal.

**Parameters:**

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

**Returns:**

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

### Goal

```csharp theme={null}
Goal Goal
```

Goal containing the goal of the objeictive.

### Name

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

String containing the name of the objective.

Implements [IVariableName]().

### SolveForValue

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

Double containing the value to be solved for for the `Goal.SolveFor` goal.

### Weight

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

Goal containing the relative weight of the objective. Used for multi-objective problems and ignored for single objetive problems.

## Property Documentation

### Goal

```csharp theme={null}
Goal Goal
```

Goal containing the goal of the objeictive.

### Name

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

String containing the name of the objective.

Implements [IVariableName]().

### SolveForValue

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

Double containing the value to be solved for for the Goal.SolveFor goal.

### Weight

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

Goal containing the relative weight of the objective. Used for multi-objective problems and ignored for single objective problems.
