langgoap.SoftGoal#

class SoftGoal(conditions=<factory>, weight=1.0, name='')[source]#

An optional goal condition with a utility weight (oversubscription planning).

Hard goal conditions (GoalSpec.conditions) must be satisfied for a plan to be valid. Soft goals are optional — the planner prefers plans that achieve them but will not fail if they cannot be satisfied.

Parameters:
  • conditions (Mapping[str, Any])

  • weight (float)

  • name (str)

conditions#

Target conditions for this soft goal. Accepted as a plain dict; silently wrapped in MappingProxyType.

Type:

Mapping[str, Any]

weight#

Non-negative utility weight (default 1.0). Higher values make this goal more valuable; the planner maximises the total achieved weight across all soft goals when selecting among plans.

Type:

float

name#

Optional human-readable identifier used in logging and CSPMetadata objective keys. Defaults to str(conditions) when empty.

Type:

str

__init__(conditions=<factory>, weight=1.0, name='')#
Parameters:
  • conditions (Mapping[str, Any])

  • weight (float)

  • name (str)

Return type:

None

Methods

__init__([conditions, weight, name])

from_dict(data)

Reconstruct from the dict produced by to_dict().

to_dict()

Serialise to a JSON-native dict (inverse of from_dict()).

Attributes

conditions

weight

name

label

Return name if set, else a compact conditions string.