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

#include <elemental_differencer.h>

Classes

struct  AttributeDifference
struct  ElementDifference
 The difference for an ElementType. More...

Public Member Functions

 ElementalDifference ()=default
const ElementDifferenceelement_difference (const ElementType e) const
ElementDifferencemutable_element_difference (const ElementType e)
template<typename AttrType>
const AttributeDifference< AttrType > & attr_difference (const AttrType a) const
template<typename AttrType>
AttributeDifference< AttrType > & mutable_attr_difference (const AttrType a)
bool Empty () const
bool model_name_different () const
void set_model_name_different (bool value)
bool primary_objective_name_different () const
void set_primary_objective_name_different (bool value)

Static Public Member Functions

static ElementalDifference Create (const Elemental &first, const Elemental &second, const ElementalDifferenceOptions &options={})
 Returns the difference between two Elementals.
static std::string DescribeDifference (const Elemental &first, const Elemental &second, const ElementalDifferenceOptions &options={})
 Returns a string describing the difference between two models.
static std::string Describe (const Elemental &first, const Elemental &second, const ElementalDifference &difference)

Detailed Description

Holds the difference between the model from two Elementals. Typically used to check if two Elemental objects are the same, and provide a nice description of how they differ if they are not the same.

Note
:
  • This is an entirely separate concept from the Diff object held by an an Elemental, which tracks changes to an Elemental from a point in time. The similarity in names is unfortunate and confusing.
  • This class only tracks differences between the models, it ignores any Diff objects either Elemental contains.

Definition at line 67 of file elemental_differencer.h.

Constructor & Destructor Documentation

◆ ElementalDifference()

operations_research::math_opt::ElementalDifference::ElementalDifference ( )
explicitdefault

Member Function Documentation

◆ attr_difference()

template<typename AttrType>
const AttributeDifference< AttrType > & operations_research::math_opt::ElementalDifference::attr_difference ( const AttrType a) const
inline

Definition at line 146 of file elemental_differencer.h.

◆ Create()

ElementalDifference operations_research::math_opt::ElementalDifference::Create ( const Elemental & first,
const Elemental & second,
const ElementalDifferenceOptions & options = {} )
static

Returns the difference between two Elementals.

We can CHECK here, we just read the element from the set.

NOLINTNEXTLINE(clang-diagnostic-pre-c++20-compat)

Definition at line 68 of file elemental_differencer.cc.

◆ Describe()

std::string operations_research::math_opt::ElementalDifference::Describe ( const Elemental & first,
const Elemental & second,
const ElementalDifference & difference )
static

Returns a string describing difference, using data from first and second to make the output more human readable (e.g. show element names), or CHECK fails on bad input (see below).

Advanced use, generally prefer DescribeDifference(const Elemental&, / const Elemental&, const ElementalDifferenceOptions&) instead, which cannot CHECK fail. Useful if you want to compute the difference and do some logical operations before (perhaps conditionally) converting the difference to a string.

This function can CHECK fail if difference claims that first or second contains an element which is missing. A sufficient condition to ensure that this function will NOT CHECK is to invoke it as Describe(first, second, Create(first, second)) to ensure that the models are correct and not modified between Create() and Describe().

NOLINTNEXTLINE(clang-diagnostic-pre-c++20-compat)

Definition at line 155 of file elemental_differencer.cc.

◆ DescribeDifference()

std::string operations_research::math_opt::ElementalDifference::DescribeDifference ( const Elemental & first,
const Elemental & second,
const ElementalDifferenceOptions & options = {} )
static

Returns a string describing the difference between two models.

Definition at line 247 of file elemental_differencer.cc.

◆ element_difference()

const ElementDifference & operations_research::math_opt::ElementalDifference::element_difference ( const ElementType e) const
inline

Definition at line 136 of file elemental_differencer.h.

◆ Empty()

bool operations_research::math_opt::ElementalDifference::Empty ( ) const

Definition at line 52 of file elemental_differencer.cc.

◆ model_name_different()

bool operations_research::math_opt::ElementalDifference::model_name_different ( ) const
inline

Definition at line 157 of file elemental_differencer.h.

◆ mutable_attr_difference()

template<typename AttrType>
AttributeDifference< AttrType > & operations_research::math_opt::ElementalDifference::mutable_attr_difference ( const AttrType a)
inline

Definition at line 151 of file elemental_differencer.h.

◆ mutable_element_difference()

ElementDifference & operations_research::math_opt::ElementalDifference::mutable_element_difference ( const ElementType e)
inline

Definition at line 141 of file elemental_differencer.h.

◆ primary_objective_name_different()

bool operations_research::math_opt::ElementalDifference::primary_objective_name_different ( ) const
inline

Definition at line 162 of file elemental_differencer.h.

◆ set_model_name_different()

void operations_research::math_opt::ElementalDifference::set_model_name_different ( bool value)
inline

Definition at line 158 of file elemental_differencer.h.

◆ set_primary_objective_name_different()

void operations_research::math_opt::ElementalDifference::set_primary_objective_name_different ( bool value)
inline

Definition at line 165 of file elemental_differencer.h.


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