Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::fz::Variable Struct Reference

#include <model.h>

Public Member Functions

bool Merge (absl::string_view other_name, const Domain &other_domain, bool other_temporary)
 
std::string DebugString () const
 

Public Attributes

std::string name
 
Domain domain
 
bool temporary: 1
 
bool active: 1
 

Friends

class Model
 

Detailed Description

An int var is a name with a domain of possible values, along with some tags. Typically, a Variable is on the heap, and owned by the global Model object.

Definition at line 120 of file model.h.

Member Function Documentation

◆ DebugString()

std::string operations_research::fz::Variable::DebugString ( ) const

Definition at line 792 of file model.cc.

◆ Merge()

bool operations_research::fz::Variable::Merge ( absl::string_view other_name,
const Domain & other_domain,
bool other_temporary )

This method tries to unify two variables. This can happen during the parsing of the model or during presolve. This is possible if at least one of the two variable is not the target of a constraint. (otherwise it returns false). The semantic of the merge is the following:

  • the resulting domain is the intersection of the two domains.
  • if one variable is not temporary, the result is not temporary.
  • if one variable is temporary, the name is the name of the other variable. If both variables are temporary or both variables are not temporary, the name is chosen arbitrarily between the two names.

Definition at line 782 of file model.cc.

Friends And Related Symbol Documentation

◆ Model

friend class Model
friend

Definition at line 148 of file model.h.

Member Data Documentation

◆ active

bool operations_research::fz::Variable::active

Indicates if the variable should be created at all. A temporary variable can be unreachable in the active model if nobody uses it. In that case, there is no need to create it.

Definition at line 145 of file model.h.

◆ domain

Domain operations_research::fz::Variable::domain

Definition at line 137 of file model.h.

◆ name

std::string operations_research::fz::Variable::name

Definition at line 136 of file model.h.

◆ temporary

bool operations_research::fz::Variable::temporary

Indicates if the variable is a temporary variable created when flattening the model. For instance, if you write x == y * z + y, then it will be expanded into y * z == t and x = t + y. And t will be a temporary variable.

Definition at line 141 of file model.h.


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