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

Detailed Description

Represents a quadratic term in a sum: coefficient * variable_1 * variable_2. Invariant:

  • first_variable.storage() == second_variable.storage(). The constructor will CHECK fail if not satisfied.

Definition at line 658 of file variable_and_expressions.h.

#include <variable_and_expressions.h>

Public Member Functions

 QuadraticTerm ()=delete
 QuadraticTerm (Variable first_variable, Variable second_variable, double coefficient)
double coefficient () const
Variable first_variable () const
Variable second_variable () const
QuadraticTermKey GetKey () const
 This is useful for working with IdMaps.
QuadraticTermoperator*= (double value)
QuadraticTermoperator/= (double value)

Friends

QuadraticTerm operator- (QuadraticTerm term)
 ------------------------— Subtraction (-) ------------------------------—
QuadraticTerm operator* (double lhs, QuadraticTerm rhs)
 -------------------------— Multiplication (*) --------------------------—
QuadraticTerm operator* (QuadraticTerm lhs, double rhs)
QuadraticTerm operator/ (QuadraticTerm lhs, double rhs)
 ----------------------------— Division (/) -----------------------------—

Constructor & Destructor Documentation

◆ QuadraticTerm() [1/2]

operations_research::math_opt::QuadraticTerm::QuadraticTerm ( )
delete

◆ QuadraticTerm() [2/2]

operations_research::math_opt::QuadraticTerm::QuadraticTerm ( Variable first_variable,
Variable second_variable,
double coefficient )
inline
Note
This will CHECK fail if first_variable.storage() != second_variable.storage().

QuadraticTerm (no arithmetic)

Definition at line 2044 of file variable_and_expressions.h.

Member Function Documentation

◆ coefficient()

double operations_research::math_opt::QuadraticTerm::coefficient ( ) const
inline

Definition at line 2053 of file variable_and_expressions.h.

◆ first_variable()

Variable operations_research::math_opt::QuadraticTerm::first_variable ( ) const
inline

Definition at line 2054 of file variable_and_expressions.h.

◆ GetKey()

QuadraticTermKey operations_research::math_opt::QuadraticTerm::GetKey ( ) const
inline

This is useful for working with IdMaps.

Definition at line 2057 of file variable_and_expressions.h.

◆ operator*=()

QuadraticTerm & operations_research::math_opt::QuadraticTerm::operator*= ( double value)
inline
Note
Not touching variables in term, just modifying coefficient, so no need to check that models agree.

Definition at line 2625 of file variable_and_expressions.h.

◆ operator/=()

QuadraticTerm & operations_research::math_opt::QuadraticTerm::operator/= ( double value)
inline
Note
Not touching variables in term, just modifying coefficient, so no need to check that models agree.

Definition at line 2645 of file variable_and_expressions.h.

◆ second_variable()

Variable operations_research::math_opt::QuadraticTerm::second_variable ( ) const
inline

Definition at line 2055 of file variable_and_expressions.h.

◆ operator* [1/2]

QuadraticTerm operator* ( double lhs,
QuadraticTerm rhs )
friend

-------------------------— Multiplication (*) --------------------------—

Note
A friend of QuadraticTerm, but does not touch variables

Definition at line 2387 of file variable_and_expressions.h.

◆ operator* [2/2]

QuadraticTerm operator* ( QuadraticTerm lhs,
double rhs )
friend
Note
A friend of QuadraticTerm, but does not touch variables

Definition at line 2482 of file variable_and_expressions.h.

◆ operator-

QuadraticTerm operator- ( QuadraticTerm term)
friend

------------------------— Subtraction (-) ------------------------------—

We declare those operator overloads that result in a QuadraticTerm, stated in lexicographic ordering based on lhs type, rhs type):

Note
A friend of QuadraticTerm, but does not touch variables

Definition at line 2260 of file variable_and_expressions.h.

◆ operator/

QuadraticTerm operator/ ( QuadraticTerm lhs,
double rhs )
friend

----------------------------— Division (/) -----------------------------—

Note
A friend of QuadraticTerm, but does not touch variables

Definition at line 2495 of file variable_and_expressions.h.


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