langgoap.HardSoftScore

langgoap.HardSoftScore#

class HardSoftScore(hard=0.0, soft=0.0)[source]#

A two-level score with hard and soft components.

hard is bounded above by 0. A feasible plan has hard == 0.0; every hard-constraint violation subtracts its penalty amount. soft has no sign restriction — maximize objectives push it positive, minimize objectives and soft-constraint violations push it negative.

Comparison is lexicographic: a plan with a greater (less-negative) hard is strictly better; ties break by soft (greater is better). Using > is more natural than < because rewards accumulate positively.

Parameters:
  • hard (float)

  • soft (float)

__init__(hard=0.0, soft=0.0)#
Parameters:
  • hard (float)

  • soft (float)

Return type:

None

Methods

__init__([hard, soft])

is_feasible()

Return True if this score represents a feasible plan.

Attributes

hard

soft

value

Sum of the two levels.