Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::math_opt::QuadraticConstraint Class Referencefinal

#include <quadratic_constraint.h>

Inheritance diagram for operations_research::math_opt::QuadraticConstraint:
operations_research::math_opt::ModelStorageElement< ElementType::kQuadraticConstraint, QuadraticConstraint > operations_research::math_opt::ModelStorageItem

Public Member Functions

double lower_bound () const
double upper_bound () const
absl::string_view name () const
bool is_linear_coefficient_nonzero (Variable variable) const
bool is_quadratic_coefficient_nonzero (Variable first_variable, Variable second_variable) const
double linear_coefficient (Variable variable) const
double quadratic_coefficient (Variable first_variable, Variable second_variable) const
std::vector< VariableNonzeroVariables () const
BoundedQuadraticExpression AsBoundedQuadraticExpression () const
std::string ToString () const
 ModelStorageElement (ModelStorageCPtr storage, IdType id)
 ModelStorageElement (const ModelStorageElement &)=default
 ModelStorageElement (ModelStorageElement &&)=default
Public Member Functions inherited from operations_research::math_opt::ModelStorageElement< ElementType::kQuadraticConstraint, QuadraticConstraint >
 ModelStorageElement (ModelStorageCPtr storage, IdType id)
int64_t id () const
IdType typed_id () const
Public Member Functions inherited from operations_research::math_opt::ModelStorageItem
ModelStorageCPtr storage () const

Additional Inherited Members

Public Types inherited from operations_research::math_opt::ModelStorageElement< ElementType::kQuadraticConstraint, QuadraticConstraint >
using IdType
 The typed integer used for ids.
Protected Member Functions inherited from operations_research::math_opt::ModelStorageElement< ElementType::kQuadraticConstraint, QuadraticConstraint >
ModelStorageElementoperator= (const ModelStorageElement &)=default
 ~ModelStorageElement ()=default
Protected Member Functions inherited from operations_research::math_opt::ModelStorageItem
 ModelStorageItem (ModelStorageCPtr storage)
 ModelStorageItem (const ModelStorageItem &)=default
ModelStorageItemoperator= (const ModelStorageItem &)=default
 ModelStorageItem (ModelStorageItem &&)=default
ModelStorageItemoperator= (ModelStorageItem &&)=default
 ~ModelStorageItem ()=default

Detailed Description

A value type that references a quadratic constraint from ModelStorage. Usually this type is passed by copy.

Definition at line 40 of file quadratic_constraint.h.

Member Function Documentation

◆ AsBoundedQuadraticExpression()

BoundedQuadraticExpression operations_research::math_opt::QuadraticConstraint::AsBoundedQuadraticExpression ( ) const

Returns the constraints as a bounded quadratic expression.

The quadratic expression will have a zero offset, even if the constraint was created with a non-zero one. For example:

const QuadraticConstraint c = model.AddQuadraticConstraint(3.2 <= x*x + 1.0 <= 4.2);

///< Here e will contain 3.2 - 1.0 <= x*x <= 4.2 - 1.0. const BoundedQuadraticExpression e = c.AsBoundedQuadraticExpression();

Definition at line 26 of file quadratic_constraint.cc.

◆ is_linear_coefficient_nonzero()

bool operations_research::math_opt::QuadraticConstraint::is_linear_coefficient_nonzero ( Variable variable) const
inline

Definition at line 105 of file quadratic_constraint.h.

◆ is_quadratic_coefficient_nonzero()

bool operations_research::math_opt::QuadraticConstraint::is_quadratic_coefficient_nonzero ( Variable first_variable,
Variable second_variable ) const
inline

Definition at line 110 of file quadratic_constraint.h.

◆ linear_coefficient()

double operations_research::math_opt::QuadraticConstraint::linear_coefficient ( Variable variable) const
inline

Returns 0.0 if the variable does not appear in the linear part of the constraint.

Definition at line 115 of file quadratic_constraint.h.

◆ lower_bound()

double operations_research::math_opt::QuadraticConstraint::lower_bound ( ) const
inline

Inline function implementations

Definition at line 90 of file quadratic_constraint.h.

◆ ModelStorageElement() [1/3]

operations_research::math_opt::ModelStorageElement< element_type, Derived, generate_equality >::ModelStorageElement ( const ModelStorageElement & )
default

◆ ModelStorageElement() [2/3]

operations_research::math_opt::ModelStorageElement< element_type, Derived, generate_equality >::ModelStorageElement ( ModelStorageCPtr storage,
IdType id )
inline

Definition at line 81 of file model_storage_item.h.

◆ ModelStorageElement() [3/3]

operations_research::math_opt::ModelStorageElement< element_type, Derived, generate_equality >::ModelStorageElement ( ModelStorageElement && )
default

◆ name()

absl::string_view operations_research::math_opt::QuadraticConstraint::name ( ) const
inline

Definition at line 98 of file quadratic_constraint.h.

◆ NonzeroVariables()

std::vector< Variable > operations_research::math_opt::QuadraticConstraint::NonzeroVariables ( ) const
inline

All variables that appear in the quadratic constraint with a nonzero coefficient: in the linear terms, the quadratic terms, or both. Order is not defined.

Definition at line 135 of file quadratic_constraint.h.

◆ quadratic_coefficient()

double operations_research::math_opt::QuadraticConstraint::quadratic_coefficient ( Variable first_variable,
Variable second_variable ) const
inline

Returns 0.0 if the variable does not appear in the quadratic part of the constraint.

Definition at line 123 of file quadratic_constraint.h.

◆ ToString()

std::string operations_research::math_opt::QuadraticConstraint::ToString ( ) const
inline

Returns a detailed string description of the contents of the constraint (not its name, use << for that instead).

Definition at line 139 of file quadratic_constraint.h.

◆ upper_bound()

double operations_research::math_opt::QuadraticConstraint::upper_bound ( ) const
inline

Definition at line 94 of file quadratic_constraint.h.


The documentation for this class was generated from the following files: