Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
ortools.sat.python.cp_model_helper Namespace Reference

Functions

bool is_boolean (Any x)
 
bool is_zero (Any x)
 
bool is_one (Any x)
 
bool is_minus_one (Any x)
 
int assert_is_int64 (Any x)
 
int assert_is_int32 (Any x)
 
int assert_is_zero_or_one (Any x)
 
Union[int, float] assert_is_a_number (Any x)
 
int to_capped_int64 (int v)
 
int capped_subtraction (int x, int y)
 

Variables

int INT_MIN = -9223372036854775808
 
int INT_MAX = 9223372036854775807
 
int INT32_MIN = -2147483648
 
int INT32_MAX = 2147483647
 

Detailed Description

helpers methods for the cp_model module.

Function Documentation

◆ assert_is_a_number()

Union[int, float] ortools.sat.python.cp_model_helper.assert_is_a_number ( Any x)
Asserts that x is a number and returns it casted to an int or a float.

Definition at line 93 of file cp_model_helper.py.

◆ assert_is_int32()

int ortools.sat.python.cp_model_helper.assert_is_int32 ( Any x)
Asserts that x is integer and x is in [min_int_32, max_int_32] and returns it casted to an int.

Definition at line 73 of file cp_model_helper.py.

◆ assert_is_int64()

int ortools.sat.python.cp_model_helper.assert_is_int64 ( Any x)
Asserts that x is integer and x is in [min_int_64, max_int_64] and returns it casted to an int.

Definition at line 63 of file cp_model_helper.py.

◆ assert_is_zero_or_one()

int ortools.sat.python.cp_model_helper.assert_is_zero_or_one ( Any x)
Asserts that x is 0 or 1 and returns it as an int.

Definition at line 83 of file cp_model_helper.py.

◆ capped_subtraction()

int ortools.sat.python.cp_model_helper.capped_subtraction ( int x,
int y )
Saturated arithmetics. Returns x - y truncated to the int64_t range.

Definition at line 111 of file cp_model_helper.py.

◆ is_boolean()

bool ortools.sat.python.cp_model_helper.is_boolean ( Any x)
Checks if the x is a boolean.

Definition at line 27 of file cp_model_helper.py.

◆ is_minus_one()

bool ortools.sat.python.cp_model_helper.is_minus_one ( Any x)
Checks if x is -1 or -1.0 .

Definition at line 54 of file cp_model_helper.py.

◆ is_one()

bool ortools.sat.python.cp_model_helper.is_one ( Any x)
Checks if x is 1 or 1.0.

Definition at line 45 of file cp_model_helper.py.

◆ is_zero()

bool ortools.sat.python.cp_model_helper.is_zero ( Any x)
Checks if the x is 0 or 0.0.

Definition at line 36 of file cp_model_helper.py.

◆ to_capped_int64()

int ortools.sat.python.cp_model_helper.to_capped_int64 ( int v)
Restrict v within [INT_MIN..INT_MAX] range.

Definition at line 102 of file cp_model_helper.py.

Variable Documentation

◆ INT32_MAX

int ortools.sat.python.cp_model_helper.INT32_MAX = 2147483647

Definition at line 24 of file cp_model_helper.py.

◆ INT32_MIN

int ortools.sat.python.cp_model_helper.INT32_MIN = -2147483648

Definition at line 23 of file cp_model_helper.py.

◆ INT_MAX

int ortools.sat.python.cp_model_helper.INT_MAX = 9223372036854775807

Definition at line 22 of file cp_model_helper.py.

◆ INT_MIN

int ortools.sat.python.cp_model_helper.INT_MIN = -9223372036854775808

Definition at line 21 of file cp_model_helper.py.