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

Classes

class  SparseVectorFilter
 

Functions

sparse_containers_pb2.SparseDoubleVectorProto to_sparse_double_vector_proto (Mapping[VarOrConstraintType, float] terms)
 
sparse_containers_pb2.SparseInt32VectorProto to_sparse_int32_vector_proto (Mapping[VarOrConstraintType, int] terms)
 
Dict[model.Variable, float] parse_variable_map (sparse_containers_pb2.SparseDoubleVectorProto proto, model.Model mod)
 
Dict[model.LinearConstraint, float] parse_linear_constraint_map (sparse_containers_pb2.SparseDoubleVectorProto proto, model.Model mod)
 

Variables

 VarOrConstraintType
 
 VariableFilter = SparseVectorFilter[model.Variable]
 
 LinearConstraintFilter = SparseVectorFilter[model.LinearConstraint]
 

Detailed Description

Sparse vectors and matrices using variables and constraints from Model.

Analogous to sparse_containers.proto, with bidirectional conversion.

Function Documentation

◆ parse_linear_constraint_map()

Dict[model.LinearConstraint, float] ortools.math_opt.python.sparse_containers.parse_linear_constraint_map ( sparse_containers_pb2.SparseDoubleVectorProto proto,
model.Model mod )
Converts a sparse vector of linear constraints from proto to dict representation.

Definition at line 67 of file sparse_containers.py.

◆ parse_variable_map()

Dict[model.Variable, float] ortools.math_opt.python.sparse_containers.parse_variable_map ( sparse_containers_pb2.SparseDoubleVectorProto proto,
model.Model mod )
Converts a sparse vector of variables from proto to dict representation.

Definition at line 57 of file sparse_containers.py.

◆ to_sparse_double_vector_proto()

sparse_containers_pb2.SparseDoubleVectorProto ortools.math_opt.python.sparse_containers.to_sparse_double_vector_proto ( Mapping[VarOrConstraintType, float] terms)
Converts a sparse vector from proto to dict representation.

Definition at line 29 of file sparse_containers.py.

◆ to_sparse_int32_vector_proto()

sparse_containers_pb2.SparseInt32VectorProto ortools.math_opt.python.sparse_containers.to_sparse_int32_vector_proto ( Mapping[VarOrConstraintType, int] terms)
Converts a sparse vector from proto to dict representation.

Definition at line 43 of file sparse_containers.py.

Variable Documentation

◆ LinearConstraintFilter

ortools.math_opt.python.sparse_containers.LinearConstraintFilter = SparseVectorFilter[model.LinearConstraint]

Definition at line 124 of file sparse_containers.py.

◆ VariableFilter

ortools.math_opt.python.sparse_containers.VariableFilter = SparseVectorFilter[model.Variable]

Definition at line 123 of file sparse_containers.py.

◆ VarOrConstraintType

ortools.math_opt.python.sparse_containers.VarOrConstraintType
Initial value:
1= TypeVar(
2 "VarOrConstraintType", model.Variable, model.LinearConstraint
3)

Definition at line 24 of file sparse_containers.py.