Function: constrained()
@kortexya/reasoninglayer / constrained
Function: constrained()
Section titled “Function: constrained()”constrained(
name,constraint):ConstrainedPlainVar
Defined in: src/builders/psi.ts:337
Create a constrained variable for use in psi() features.
Parameters
Section titled “Parameters”string
Variable name (must start with ?, e.g., "?Score").
constraint
Section titled “constraint”Constraint term, typically from guard() or psi().
Returns
Section titled “Returns”A ConstrainedPlainVar that can be used as a feature value in psi().
Remarks
Section titled “Remarks”Constrained variables are only meaningful in inference contexts. When the
containing psi() term is passed to an inference method, the constrained
variable is converted to { name: "?S", constraint: {...} } in the untagged
FeatureInputValueDto format.
Example
Section titled “Example”import { psi, constrained, guard } from '@kortexya/reasoninglayer';
const eligible = psi("eligible", { applicant: "?A", score: constrained("?S", guard("gt", 700)),});