Exhort.SAT.Expr (Exhort v0.1.0)

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

Link to this function

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.

Link to this macro

bool_and(list)

(macro)

Create logical AND constraint on the list of booleans.

Link to this macro

bool_or(list)

(macro)

Create a constraint that requires one of the booleans in the list to be true.

Link to this function

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.

Link to this function

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.

Link to this function

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.

Link to this function

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 name
  • start is the start of the interval
  • size is the size of the interval
  • stop is the end of the interval
Link to this macro

implication(bool1, bool2)

(macro)

Add an implication constraint where bool1 implies bool2.

Link to this macro

new(expr, opts \\ [])

(macro)

Create a new expression using the DSL.

If the expression contains a comparison operator, it becomes a constraint.

Link to this function

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.