MinLink

From OpenCog
(Redirected from MaxLink)
Jump to: navigation, search

The MinLink and MaxLink are numeric Link types that compute and return the minimum and maximum of their arguments. When given vector arguments, they compute the min/max values component by component.

Examples:

(cog-execute!
   (MinLink
      (Number 1 6 7)
      (Number 2 5 8)
      (Number 3 4 9)))

returns

 (NumberNode 1 4 7)

while

(cog-execute!
   (MaxLink
      (Number 1 6 7)
      (Number 2 5 8)
      (Number 3 4 9)))

returns

 (NumberNode 3 6 9)

When possible, numeric values are reduced to least form:

(cog-execute!
   (MaxLink
      (Number 1 6 7)
      (Number 2 5 8)
      (Variable "X")))

returns

(MaxLink
  (VariableNode "X")
  (NumberNode 2 6 8)

While

(Concept "A" (stv 0.1 0.7))
(Concept "B" (stv 0.6 0.2))
(cog-execute!
   (MaxLink
      (TruthValueOf (Concept "A"))
      (TruthValueOf (Concept "B"))))

returns

 (FloatValue 0.6 0.7)