Exhort.SAT.Expr (Exhort v0.1.1)
Create an expression in the expression language.
If the expression contains a comparison operator, it will be a constraint. Otherwise, it will be a linear expression.
Use the new/2
macro to create a new expression.
Use the remaining functions to create variables and list-based constraints.
Link to this section Summary
Functions
Create a constraint on the list ensuring that each variable in the list has a different value.
Create logical AND constraint on the list of booleans.
Create a constraint that requires one of the booleans in the list to be true.
Define a new boolean variable. It must later be added to the model.
Definite a constant. It must later be added to the model.
Define a new integer variable. It must later be added to the model.
Define an interval variable. It must later be added to the model.
Add an implication constraint where bool1
implies bool2
.
Create a new expression using the DSL.
Create a constraint on the list ensuring there are no overlap among the variables in the list.
Link to this section Functions
all_different(list, opts \\ [])
@spec all_different(list(), Keyword.t()) :: Exhort.SAT.Constraint.t()
Create a constraint on the list ensuring that each variable in the list has a different value.
Create logical AND constraint on the list of booleans.
Create a constraint that requires one of the booleans in the list to be true.
def_bool_var(name)
@spec def_bool_var(name :: String.t()) :: Exhort.SAT.BoolVar.t()
Define a new boolean variable. It must later be added to the model.
def_constant(name, value)
@spec def_constant( name :: String.t() | atom(), value :: integer() ) :: Exhort.SAT.IntVar.t()
Definite a constant. It must later be added to the model.
def_int_var(name, domain)
@spec def_int_var( name :: String.t(), domain :: {lower_bound :: integer(), upper_bound :: integer()} | integer() ) :: Exhort.SAT.IntVar.t()
Define a new integer variable. It must later be added to the model.
def_interval_var(name, start, size, stop, opts \\ [])
@spec def_interval_var( name :: String.t(), start :: atom() | String.t(), size :: integer(), stop :: atom() | String.t(), opts :: Keyword.t() ) :: Exhort.SAT.IntervalVar.t()
Define an interval variable. It must later be added to the model.
See Exhort.SAT.Builder.def_interval_var/6
.
name
is the variable namestart
is the start of the intervalsize
is the size of the intervalstop
is the end of the interval
Add an implication constraint where bool1
implies bool2
.
Create a new expression using the DSL.
If the expression contains a comparison operator, it becomes a constraint.
no_overlap(list, opts \\ [])
@spec no_overlap(list(), Keyword.t()) :: Exhort.SAT.Constraint.t()
Create a constraint on the list ensuring there are no overlap among the variables in the list.