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

Functions

bool is_integral (Any x)
 
bool is_a_number (Any x)
 
bool is_zero (Any x)
 
bool is_one (Any x)
 
bool is_minus_one (Any x)
 
np.double assert_is_a_number (NumberT x)
 
npt.NDArray[np.double] assert_is_a_number_array (Sequence[NumberT] x)
 

Variables

 NumberT = Union[numbers.Number, np.number]
 

Detailed Description

helpers methods for the cp_model_builder module on numbers.

Function Documentation

◆ assert_is_a_number()

np.double ortools.linear_solver.python.model_builder_numbers.assert_is_a_number ( NumberT x)
Asserts that x is a number and converts to a np.double.

Definition at line 54 of file model_builder_numbers.py.

◆ assert_is_a_number_array()

npt.NDArray[np.double] ortools.linear_solver.python.model_builder_numbers.assert_is_a_number_array ( Sequence[NumberT] x)
Asserts x is a list of numbers and converts it to np.array(np.double).

Definition at line 61 of file model_builder_numbers.py.

◆ is_a_number()

bool ortools.linear_solver.python.model_builder_numbers.is_a_number ( Any x)
Checks if x has either a number.Number or a np.double type.

Definition at line 30 of file model_builder_numbers.py.

◆ is_integral()

bool ortools.linear_solver.python.model_builder_numbers.is_integral ( Any x)
Checks if x has either a number.Integral or a np.integer type.

Definition at line 25 of file model_builder_numbers.py.

◆ is_minus_one()

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

Definition at line 49 of file model_builder_numbers.py.

◆ is_one()

bool ortools.linear_solver.python.model_builder_numbers.is_one ( Any x)
Checks if x is 1 or 1.0.

Definition at line 44 of file model_builder_numbers.py.

◆ is_zero()

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

Definition at line 39 of file model_builder_numbers.py.

Variable Documentation

◆ NumberT

ortools.linear_solver.python.model_builder_numbers.NumberT = Union[numbers.Number, np.number]

Definition at line 22 of file model_builder_numbers.py.