Table of Contents

Class FrozenStudy

Namespace
OptunaSharp
Assembly
OptunaSharp.dll

Basic attributes of a Study. Port of optuna/study/_frozen.py: FrozenStudy.

This class is private in Optuna and not referenced by Optuna users.

public class FrozenStudy : IEquatable<FrozenStudy>, IComparable<FrozenStudy>
Inheritance
FrozenStudy
Implements
Inherited Members

Constructors

FrozenStudy(string, StudyDirection?, OrderedDict<string, object?>, OrderedDict<string, object?>, int, IEnumerable<StudyDirection>?)

Builds a study record from persisted metadata and objective directions.

public FrozenStudy(string studyName, StudyDirection? direction, OrderedDict<string, object?> userAttrs, OrderedDict<string, object?> systemAttrs, int studyId, IEnumerable<StudyDirection>? directions = null)

Parameters

studyName string

Name identifying the study in the selected storage.

direction StudyDirection?

Single objective direction; ignored when a directions sequence is supplied.

userAttrs OrderedDict<string, object>

User metadata; values should be JSON serializable for persistent storage.

systemAttrs OrderedDict<string, object>

Internal metadata used by samplers and storage; preserve reserved keys.

studyId int

Storage identifier of the study; distinct from its name.

directions IEnumerable<StudyDirection>

Objective directions in the same order as the objective values.

Remarks

Directions are materialized; supplied attribute dictionaries and any best-trial object are retained by reference.

Exceptions

ValueError

Neither direction nor directions is supplied.

Properties

Direction

StudyDirection of the study. Only available during single-objective optimization.

public StudyDirection Direction { get; }

Property Value

StudyDirection

Exceptions

RuntimeError

There is more than one objective direction.

ArgumentOutOfRangeException

The directions collection is empty.

Directions

A list of StudyDirection objects.

public List<StudyDirection> Directions { get; }

Property Value

List<StudyDirection>

StudyName

Name of the Study.

public string StudyName { get; }

Property Value

string

SystemAttrs

Dictionary that contains the attributes internally set by Optuna.

public OrderedDict<string, object?> SystemAttrs { get; }

Property Value

OrderedDict<string, object>

UserAttrs

Dictionary that contains the attributes of the Study set with SetUserAttr(string, object?).

public OrderedDict<string, object?> UserAttrs { get; }

Property Value

OrderedDict<string, object>

Methods

CompareTo(FrozenStudy?)

Python lt / le: FrozenStudy is ordered by study id.

public int CompareTo(FrozenStudy? other)

Parameters

other FrozenStudy

Study record to compare by identifier; null sorts before this instance.

Returns

int

Negative, zero, or positive according to study identifier order; null sorts first.

Equals(FrozenStudy?)

Python eq: value equality over every field (other.dict == self.dict) — study name, directions, user attributes, system attributes and study id.

public bool Equals(FrozenStudy? other)

Parameters

other FrozenStudy

Value to compare with this instance; null compares unequal.

Returns

bool

True when the other value has the same type and equal recorded fields.

Equals(object?)

Compares the fields participating in value equality.

public override bool Equals(object? obj)

Parameters

obj object

Object to compare with this instance.

Returns

bool

True when the other value has the same type and equal recorded fields.

GetHashCode()

A hash consistent with Equals(FrozenStudy?). Optuna's FrozenStudy is unhashable (eq without hash); as elsewhere in the port we expose a usable hash instead.

public override int GetHashCode()

Returns

int

Hash code consistent with this type's equality contract.

Operators

operator ==(FrozenStudy?, FrozenStudy?)

Applies the == comparison using the type's value equality.

public static bool operator ==(FrozenStudy? left, FrozenStudy? right)

Parameters

left FrozenStudy

Left operand of the comparison.

right FrozenStudy

Right operand of the comparison.

Returns

bool

True when the comparison holds.

operator >(FrozenStudy, FrozenStudy)

Applies the > comparison by study identifier.

public static bool operator >(FrozenStudy left, FrozenStudy right)

Parameters

left FrozenStudy

Left operand of the comparison.

right FrozenStudy

Right operand of the comparison.

Returns

bool

True when the comparison holds.

operator >=(FrozenStudy, FrozenStudy)

Applies the >= comparison by study identifier.

public static bool operator >=(FrozenStudy left, FrozenStudy right)

Parameters

left FrozenStudy

Left operand of the comparison.

right FrozenStudy

Right operand of the comparison.

Returns

bool

True when the comparison holds.

operator !=(FrozenStudy?, FrozenStudy?)

Applies the != comparison using the type's value equality.

public static bool operator !=(FrozenStudy? left, FrozenStudy? right)

Parameters

left FrozenStudy

Left operand of the comparison.

right FrozenStudy

Right operand of the comparison.

Returns

bool

True when the comparison holds.

operator <(FrozenStudy, FrozenStudy)

Applies the < comparison by study identifier.

public static bool operator <(FrozenStudy left, FrozenStudy right)

Parameters

left FrozenStudy

Left operand of the comparison.

right FrozenStudy

Right operand of the comparison.

Returns

bool

True when the comparison holds.

operator <=(FrozenStudy, FrozenStudy)

Applies the <= comparison by study identifier.

public static bool operator <=(FrozenStudy left, FrozenStudy right)

Parameters

left FrozenStudy

Left operand of the comparison.

right FrozenStudy

Right operand of the comparison.

Returns

bool

True when the comparison holds.