Show / Hide Table of Contents

Class OptionalObjective

An optional objective in an ExactCoverGraph. An optional objective is both an IObjective and an IPossibility.

This can be satisfied if one or more attached IPossibility objects are selected. Once satisfied, this drops any remaining unknown possibilities, and notifies parent objectives that to select this possibility.

Unlike Objectives, this class can be dropped. Dropping this objetive does not immediately impact attached possibilities. These possibilities may still be dropped or selected, as long as this objective does not become satisfied. If selecting a possibility would satisfy a dropped optional objective, then the call to SudokuSpice.ConstraintBased.IObjective.TrySelectPossibility(SudokuSpice.ConstraintBased.Link) will fail.

All OptionalObjective objects must eventually be descendents of at least one Objective.

Inheritance
System.Object
OptionalObjective
Implements
IOptionalObjective
IObjective
IPossibility
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: SudokuSpice.ConstraintBased
Assembly: SudokuSpice.dll
Syntax
public sealed class OptionalObjective : IOptionalObjective, IObjective, IPossibility

Properties

| Improve this Doc View Source

IsConcrete

True if this possibility is a concrete possibility, i.e. a leaf node in the graph, as opposed to a group of other possibilities.

Declaration
public bool IsConcrete { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

State

The current state of this node in the ExactCoverGraph.

Declaration
public NodeState State { get; }
Property Value
Type Description
NodeState

Methods

| Improve this Doc View Source

CreateWithPossibilities(ReadOnlySpan<IPossibility>, Int32)

Creates an optional objective with the given possibilities attached. This objective will be satisfied when countToSatisfy of these possibilities are selected.

Note that this results in an OptionalObjective with no parent objectives. The returned objective must eventually be connected to at least one top-level required Objective object in order to behave correctly.

Declaration
public static OptionalObjective CreateWithPossibilities(ReadOnlySpan<IPossibility> possibilities, int countToSatisfy)
Parameters
Type Name Description
System.ReadOnlySpan<IPossibility> possibilities

The possibilities that could satisfy this objective.

System.Int32 countToSatisfy

The number of possibilities that must be selected to satisfy this objective.

Returns
Type Description
OptionalObjective

The newly constructed optional objective.

Exceptions
Type Condition
System.ArgumentException

If the countToSatisfy is less than 1 or is impossible with the given number of possibilities.

| Improve this Doc View Source

GetUnknownDirectPossibilities()

Retrieves any possibilities that are direct descendents of this objective and whose states are unknown.

Declaration
public IEnumerable<IPossibility> GetUnknownDirectPossibilities()
Returns
Type Description
System.Collections.Generic.IEnumerable<IPossibility>

Implements

IOptionalObjective
IObjective
IPossibility
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX