@@ -637,13 +637,10 @@ class MixedBehaviorProfile:
637637 return self._payoff(resolved_player )
638638
639639 def node_value(self , player: PlayerReference ,
640- node: NodeReference ) -> ProfileDType | None :
640+ node: NodeReference ) -> ProfileDType:
641641 """Returns the expected payoff to `player` conditional on play reaching `node`,
642642 if all players play according to the profile.
643643
644- If the node's information set is not reachable , in general the node value
645- is not well-defined. In this case , the function returns `None`.
646-
647644 Parameters
648645 ----------
649646 player : Player or str
@@ -663,10 +660,6 @@ class MixedBehaviorProfile:
663660 `node` is a string and no node in the game has that label.
664661 ValueError
665662 If `player` resolves to the chance player
666-
667- See Also
668- --------
669- MixedBehaviorProfile.infoset_prob
670663 """
671664 self._check_validity()
672665 resolved_player = self .game._resolve_player(player, " node_value" )
@@ -990,11 +983,8 @@ class MixedBehaviorProfileDouble(MixedBehaviorProfile):
990983 return value.value()
991984 return None
992985
993- def _node_value (self , player: Player , node: Node ) -> float | None:
994- cdef optional[double] value = deref(self .profile).GetPayoff(player.player, node.node)
995- if value.has_value():
996- return value.value()
997- return None
986+ def _node_value (self , player: Player , node: Node ) -> float:
987+ return deref(self.profile ).GetPayoff(player.player , node.node )
998988
999989 def _action_value(self , action: Action ) -> float | None:
1000990 cdef optional[double] value = deref(self .profile).GetPayoff(action.action)
@@ -1104,11 +1094,8 @@ class MixedBehaviorProfileRational(MixedBehaviorProfile):
11041094 return rat_to_py(value.value())
11051095 return None
11061096
1107- def _node_value (self , player: Player , node: Node ) -> Rational | None:
1108- cdef optional[c_Rational] value = deref(self .profile).GetPayoff(player.player, node.node)
1109- if value.has_value():
1110- return rat_to_py(value.value())
1111- return None
1097+ def _node_value (self , player: Player , node: Node ) -> Rational:
1098+ return rat_to_py(deref(self.profile ).GetPayoff(player.player , node.node ))
11121099
11131100 def _action_value(self , action: Action ) -> Rational | None:
11141101 cdef optional[c_Rational] value = deref(self .profile).GetPayoff(action.action)
0 commit comments