Table of Contents

Class OptunaStudyOptions

Namespace
OptunaSharp.Extensions
Assembly
OptunaSharp.dll

The container-bound defaults an IOptunaStudyFactory applies when a call to CreateStudy(string?, StudyDirection?, bool?, IEnumerable<StudyDirection>?) leaves an argument unspecified. Configure it from AddOptunaStudyFactory(configure) so a whole application shares one study shape (direction, naming, conflict handling) while the sampler / pruner / storage come from the other AddOptuna* registrations.

Consequence: a factory reads these only as fall-backs — an explicit argument to CreateStudy(string?, StudyDirection?, bool?, IEnumerable<StudyDirection>?) always wins. Leaving DefaultDirection and DefaultDirections both null reproduces Optuna's own default (a single-objective minimize study).

public sealed class OptunaStudyOptions
Inheritance
OptunaStudyOptions
Inherited Members

Remarks

DefaultDirection (single-objective) and DefaultDirections (multi-objective) are mutually exclusive, exactly like optuna.create_study's direction / directions: set at most one. Setting both is rejected when a study is created (the factory forwards the conflict to CreateStudy(BaseStorage?, BaseSampler?, BasePruner?, string?, StudyDirection?, bool, IEnumerable<StudyDirection>?), which raises ValueError), not when this object is populated.

Properties

DefaultDirection

The single-objective optimization direction used when a CreateStudy(string?, StudyDirection?, bool?, IEnumerable<StudyDirection>?) call supplies neither direction nor directions. null (the default) defers to Optuna's own default of Minimize. Do not set this together with DefaultDirections.

public StudyDirection? DefaultDirection { get; set; }

Property Value

StudyDirection?

DefaultDirections

The multi-objective optimization directions used when a CreateStudy(string?, StudyDirection?, bool?, IEnumerable<StudyDirection>?) call supplies neither direction nor directions. null (the default) leaves the study single-objective. Do not set this together with DefaultDirection.

public IReadOnlyList<StudyDirection>? DefaultDirections { get; set; }

Property Value

IReadOnlyList<StudyDirection>

DefaultExecutorOptions

The executor options every study this factory builds starts with: the factory assigns this instance to each new study's ExecutorOptions. null (the default) leaves that setting unset, so Default applies. Optuna has no counterpart.

public TrialExecutorOptions? DefaultExecutorOptions { get; set; }

Property Value

TrialExecutorOptions

Remarks

This is the DI level of the executor's resolution: an Optimize call's executorOptions argument, or a study's own ExecutorOptions set after creation, still override it. Every study gets this same instance, so changing a property later changes the executor of all of them, from their next Optimize call on.

DefaultStudyName

The study name applied when a CreateStudy(string?, StudyDirection?, bool?, IEnumerable<StudyDirection>?) call passes no name. null (the default) lets the storage generate a unique name. Pin a name only when the factory targets a single named study (e.g. a persistent storage a worker reattaches to); reusing one name across concurrent studies collides unless LoadIfExists is true.

public string? DefaultStudyName { get; set; }

Property Value

string

LoadIfExists

The default for load_if_exists — whether creating a study whose name already exists returns the existing study (true) instead of raising DuplicatedStudyError (false, the default). Set true together with DefaultStudyName for the "many workers, one shared study" pattern.

public bool LoadIfExists { get; set; }

Property Value

bool