DotNet Reference

DotNet Reference

IntegerVariableProto

Detailed Description

An integer variable.

It will be referred to by an int32 corresponding to its index in a CpModelProto variables field.

Depending on the context, a reference to a variable whose domain is in [0, 1] can also be seen as a Boolean that will be true if the variable value is 1 and false if it is 0. When used in this context, the field name will always contain the word "literal".

Negative reference (advanced usage): to simplify the creation of a model and for efficiency reasons, all the "literal" or "variable" fields can also contain a negative index. A negative index i will refer to the negation of the integer variable at index -i -1 or to NOT the literal at the same index.

Ex: A variable index 4 will refer to the integer variable model.variables(4) and an index of -5 will refer to the negation of the same variable. A literal index 4 will refer to the logical fact that model.variable(4) == 1 and a literal index of -5 will refer to the logical fact model.variable(4) == 0.

Definition at line 244 of file CpModel.pb.cs.

Public Member Functions

 IntegerVariableProto ()
 
 IntegerVariableProto (IntegerVariableProto other)
 
IntegerVariableProto Clone ()
 
override bool Equals (object other)
 
bool Equals (IntegerVariableProto other)
 
override int GetHashCode ()
 
override string ToString ()
 
void WriteTo (pb::CodedOutputStream output)
 
int CalculateSize ()
 
void MergeFrom (IntegerVariableProto other)
 
void MergeFrom (pb::CodedInputStream input)
 

Static Public Attributes

const int NameFieldNumber = 1
 Field number for the "name" field. More...
 
const int DomainFieldNumber = 2
 Field number for the "domain" field. More...
 

Properties

static pb::MessageParser< IntegerVariableProtoParser [get]
 
static pbr::MessageDescriptor Descriptor [get]
 
string Name [get, set]
 For debug/logging only. More...
 
pbc::RepeatedField< long > Domain [get]
 The variable domain given as a sorted list of n disjoint intervals [min, max] and encoded as [min_0, max_0, ..., min_{n-1}, max_{n-1}]. More...
 

Constructor & Destructor Documentation

◆ IntegerVariableProto() [1/2]

Definition at line 261 of file CpModel.pb.cs.

◆ IntegerVariableProto() [2/2]

Definition at line 268 of file CpModel.pb.cs.

Member Function Documentation

◆ CalculateSize()

int CalculateSize ( )
inline

Definition at line 369 of file CpModel.pb.cs.

◆ Clone()

IntegerVariableProto Clone ( )
inline

Definition at line 275 of file CpModel.pb.cs.

◆ Equals() [1/2]

bool Equals ( IntegerVariableProto  other)
inline

Definition at line 328 of file CpModel.pb.cs.

◆ Equals() [2/2]

override bool Equals ( object  other)
inline

Definition at line 323 of file CpModel.pb.cs.

◆ GetHashCode()

override int GetHashCode ( )
inline

Definition at line 341 of file CpModel.pb.cs.

◆ MergeFrom() [1/2]

void MergeFrom ( IntegerVariableProto  other)
inline

Definition at line 382 of file CpModel.pb.cs.

◆ MergeFrom() [2/2]

void MergeFrom ( pb::CodedInputStream  input)
inline

Definition at line 394 of file CpModel.pb.cs.

◆ ToString()

override string ToString ( )
inline

Definition at line 352 of file CpModel.pb.cs.

◆ WriteTo()

void WriteTo ( pb::CodedOutputStream  output)
inline

Definition at line 357 of file CpModel.pb.cs.

Member Data Documentation

◆ DomainFieldNumber

const int DomainFieldNumber = 2
static

Field number for the "domain" field.

Definition at line 294 of file CpModel.pb.cs.

◆ NameFieldNumber

const int NameFieldNumber = 1
static

Field number for the "name" field.

Definition at line 280 of file CpModel.pb.cs.

Property Documentation

◆ Descriptor

pbr.MessageDescriptor Descriptor
staticget

Definition at line 251 of file CpModel.pb.cs.

◆ Domain

pbc.RepeatedField<long> Domain
get

The variable domain given as a sorted list of n disjoint intervals [min, max] and encoded as [min_0, max_0, ..., min_{n-1}, max_{n-1}].

The most common example being just [min, max]. If min == max, then this is a constant variable.

We have:

  • domain_size() is always even.
  • min == domain.front();
  • max == domain.back();
  • for all i < n : min_i <= max_i
  • for all i < n-1 : max_i + 1 < min_{i+1}.

Note that we check at validation that a variable domain is small enough so that we don't run into integer overflow in our algorithms. Because of that, you cannot just have "unbounded" variable like [0, kint64max] and should try to specify tighter domains.

Definition at line 318 of file CpModel.pb.cs.

◆ Name

string Name
getset

For debug/logging only.

Can be empty.

Definition at line 286 of file CpModel.pb.cs.

◆ Parser

pb.MessageParser<IntegerVariableProto> Parser
staticget

Definition at line 248 of file CpModel.pb.cs.


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