prescriptive
relationalai.semantics.reasoners
Prescriptive reasoning: define and solve decision problems.
Provides a declarative Python API for formulating decision problems — optimization, constraint satisfaction, or feasibility — and solving them with external solvers (HiGHS, Gurobi, Ipopt, MiniZinc, etc.).
Quick Start
Section titled “Quick Start”from relationalai.semantics import Model, Float, Integerfrom relationalai.semantics.reasoners.prescriptive import Problem
model = Model("my_problem")p = Problem(model, Float) # Float for HiGHS/Gurobi/Ipopt, Integer for MiniZinc
x = model.Relationship(f"{Float:x}")y = model.Relationship(f"{Float:y}")p.solve_for(x, name="x", lower=0, upper=10)p.solve_for(y, name="y", lower=0, upper=10)
p.minimize(x**2 + y**2)p.satisfy(model.require(x + y >= 5))p.solve("highs")Functions
Section titled “Functions”Functions exposed by this module.
all_different() Return an all-different constraint. Re-exported from
relationalai.semantics.reasoners.prescriptive.problem. implies() Return an implication constraint (`
left => right). Re-exported from relationalai.semantics.reasoners.prescriptive.problem`. special_ordered_set_type_1() Return an SOS1 constraint (at most one variable is non-zero). Re-exported from
relationalai.semantics.reasoners.prescriptive.problem. special_ordered_set_type_2() Return an SOS2 constraint (at most two consecutive variables are non-zero). Re-exported from
relationalai.semantics.reasoners.prescriptive.problem. Classes
Section titled “Classes”Classes exposed by this module.
Problem Define and solve a decision problem on a model. Re-exported from
relationalai.semantics.reasoners.prescriptive.problem. Modules and Subpackages
Section titled “Modules and Subpackages”Submodules and subpackages available under this namespace.
problem Prescriptive reasoning: define and solve decision problems.