class ORTools::Sat::Model
- ORTools::Sat::Model
- Reference
- Object
Overview
Model class contains all the variables and constraints that define the problem The variables and constraints are stored in the CpModelProto object The Class also provides all the methods used to add variables and define constraints
Defined in:
ortools-sat/model.crConstructors
Instance Method Summary
- #add_all_diff(vars : Array(Expressible))
-
#add_at_most_one(vars : Array(BoolVar))
Forces at most one of the provided boolean variables to be true
-
#add_bool_and(vars : Array(BoolVar), enforcement_literals = [] of BoolVar)
Forces all of the boolean variables to be true
-
#add_bool_or(vars : Array(BoolVar), enforcement_literals = [] of BoolVar)
Forces at least one of the boolean variables to be true
-
#add_bool_xor(vars : Array(BoolVar))
Forces an odd number of the provided boolean variables to be true
-
#add_constraint(constraint : LinearConstraint)
Implements a linear constraint in the form of a <= b or a == b.
-
#add_exactly_one(vars : Array(BoolVar))
Forces exactly one of the provided boolean variables to be true
-
#add_int_div(target : Expressible, exprs : Array(Expressible))
Forces the target to equal exprs[0] / exprs[1].
-
#add_int_mod(target : Expressible, exprs : Array(Expressible))
Forces the target to be equal exprs[0] % exprs[1].
-
#add_int_prod(target : Expressible, exprs : Array(Expressible))
Forces the target to be equal to the product of the exprs.
-
#add_max(target : Expressible, exprs : Array(Expressible))
Forces target to equal the max of all exprs
-
#add_min(target : Expressible, exprs : Array(Expressible))
Forces target to equal the min of all exprs
-
#add_none(vars : Array(BoolVar), enforcement_literals = [] of BoolVar)
Forces all BoolVars provided to be false
-
#add_not_all(vars : Array(BoolVar), enforcement_literals = [] of BoolVar)
Forces at least one of the provided boolean variables to be false
-
#maximize(expr : LinearExpression, domain = [] of Int64, offset : Float64 | Nil = nil, scaling_factor : Float64 | Nil = nil)
Create an objective to minimize
-
#minimize(expr : LinearExpression, domain = [] of Int64, offset : Float64 | Nil = nil, scaling_factor : Float64 | Nil = nil)
Create an objective to minimize
-
#new_bool_var(name = "")
Provides a
BoolVar
for boolean variables -
#new_int_var(min : Int64, max : Int64, name = "")
Provides an IntVar for integer variables
-
#set_to_bool_and(target : BoolVar, vars : Array(BoolVar))
Creates and equivelence between target variable and the result of the logical AND of the vars
-
#set_to_bool_or(target : BoolVar, vars : Array(BoolVar))
Creates and equivelence between target variable and the result of the logical OR of the vars
-
#solve : Solution
Attempts to solve
Constructor Detail
Instance Method Detail
Forces at most one of the provided boolean variables to be true
Forces all of the boolean variables to be true
When enforcement_literals are provided, this constraint will only be followed if all literals are true.
Forces at least one of the boolean variables to be true
When enforcement_literals are provided, this constraint will only be followed if all literals are true.
Forces an odd number of the provided boolean variables to be true
Implements a linear constraint in the form of a <= b or a == b.
E.g. model.add_constraint( 2x + 3y <= 44)
Forces exactly one of the provided boolean variables to be true
Forces the target to equal exprs[0] / exprs[1]. The division is rounded towards zero. For exact integer division, use product constraint and place the target as an expr. E.g. a = b * target
Forces the target to be equal exprs[0] % exprs[1].
Forces the target to be equal to the product of the exprs. The product must fit in an int64 or the model will be invalid.
Forces target to equal the max of all exprs
Forces target to equal the min of all exprs
Forces all BoolVars provided to be false
Forces at least one of the provided boolean variables to be false
Create an objective to minimize
Create an objective to minimize
Creates and equivelence between target variable and the result of the logical AND of the vars
Creates and equivelence between target variable and the result of the logical OR of the vars