Class IntegerVariableProto.Builder

  • All Implemented Interfaces:
    IntegerVariableProtoOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, java.lang.Cloneable
    Enclosing class:
    IntegerVariableProto

    public static final class IntegerVariableProto.Builder
    extends com.google.protobuf.GeneratedMessageV3.Builder<IntegerVariableProto.Builder>
    implements IntegerVariableProtoOrBuilder
     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.
     
    Protobuf type operations_research.sat.IntegerVariableProto
    • Method Detail

      • getDescriptor

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetFieldAccessorTable

        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.Builder<IntegerVariableProto.Builder>
      • clear

        public IntegerVariableProto.Builder clear()
        Specified by:
        clear in interface com.google.protobuf.Message.Builder
        Specified by:
        clear in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clear in class com.google.protobuf.GeneratedMessageV3.Builder<IntegerVariableProto.Builder>
      • getDescriptorForType

        public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
        Specified by:
        getDescriptorForType in interface com.google.protobuf.Message.Builder
        Specified by:
        getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getDescriptorForType in class com.google.protobuf.GeneratedMessageV3.Builder<IntegerVariableProto.Builder>
      • getDefaultInstanceForType

        public IntegerVariableProto getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
      • build

        public IntegerVariableProto build()
        Specified by:
        build in interface com.google.protobuf.Message.Builder
        Specified by:
        build in interface com.google.protobuf.MessageLite.Builder
      • buildPartial

        public IntegerVariableProto buildPartial()
        Specified by:
        buildPartial in interface com.google.protobuf.Message.Builder
        Specified by:
        buildPartial in interface com.google.protobuf.MessageLite.Builder
      • clone

        public IntegerVariableProto.Builder clone()
        Specified by:
        clone in interface com.google.protobuf.Message.Builder
        Specified by:
        clone in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clone in class com.google.protobuf.GeneratedMessageV3.Builder<IntegerVariableProto.Builder>
      • setField

        public IntegerVariableProto.Builder setField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                     java.lang.Object value)
        Specified by:
        setField in interface com.google.protobuf.Message.Builder
        Overrides:
        setField in class com.google.protobuf.GeneratedMessageV3.Builder<IntegerVariableProto.Builder>
      • clearField

        public IntegerVariableProto.Builder clearField​(com.google.protobuf.Descriptors.FieldDescriptor field)
        Specified by:
        clearField in interface com.google.protobuf.Message.Builder
        Overrides:
        clearField in class com.google.protobuf.GeneratedMessageV3.Builder<IntegerVariableProto.Builder>
      • clearOneof

        public IntegerVariableProto.Builder clearOneof​(com.google.protobuf.Descriptors.OneofDescriptor oneof)
        Specified by:
        clearOneof in interface com.google.protobuf.Message.Builder
        Overrides:
        clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<IntegerVariableProto.Builder>
      • setRepeatedField

        public IntegerVariableProto.Builder setRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                             int index,
                                                             java.lang.Object value)
        Specified by:
        setRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<IntegerVariableProto.Builder>
      • addRepeatedField

        public IntegerVariableProto.Builder addRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                             java.lang.Object value)
        Specified by:
        addRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<IntegerVariableProto.Builder>
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3.Builder<IntegerVariableProto.Builder>
      • mergeFrom

        public IntegerVariableProto.Builder mergeFrom​(com.google.protobuf.CodedInputStream input,
                                                      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                               throws java.io.IOException
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Specified by:
        mergeFrom in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<IntegerVariableProto.Builder>
        Throws:
        java.io.IOException
      • getName

        public java.lang.String getName()
         For debug/logging only. Can be empty.
         
        string name = 1;
        Specified by:
        getName in interface IntegerVariableProtoOrBuilder
        Returns:
        The name.
      • getNameBytes

        public com.google.protobuf.ByteString getNameBytes()
         For debug/logging only. Can be empty.
         
        string name = 1;
        Specified by:
        getNameBytes in interface IntegerVariableProtoOrBuilder
        Returns:
        The bytes for name.
      • setName

        public IntegerVariableProto.Builder setName​(java.lang.String value)
         For debug/logging only. Can be empty.
         
        string name = 1;
        Parameters:
        value - The name to set.
        Returns:
        This builder for chaining.
      • clearName

        public IntegerVariableProto.Builder clearName()
         For debug/logging only. Can be empty.
         
        string name = 1;
        Returns:
        This builder for chaining.
      • setNameBytes

        public IntegerVariableProto.Builder setNameBytes​(com.google.protobuf.ByteString value)
         For debug/logging only. Can be empty.
         
        string name = 1;
        Parameters:
        value - The bytes for name to set.
        Returns:
        This builder for chaining.
      • getDomainList

        public java.util.List<java.lang.Long> getDomainList()
         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.
         
        repeated int64 domain = 2;
        Specified by:
        getDomainList in interface IntegerVariableProtoOrBuilder
        Returns:
        A list containing the domain.
      • getDomainCount

        public int getDomainCount()
         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.
         
        repeated int64 domain = 2;
        Specified by:
        getDomainCount in interface IntegerVariableProtoOrBuilder
        Returns:
        The count of domain.
      • getDomain

        public long getDomain​(int index)
         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.
         
        repeated int64 domain = 2;
        Specified by:
        getDomain in interface IntegerVariableProtoOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The domain at the given index.
      • setDomain

        public IntegerVariableProto.Builder setDomain​(int index,
                                                      long value)
         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.
         
        repeated int64 domain = 2;
        Parameters:
        index - The index to set the value at.
        value - The domain to set.
        Returns:
        This builder for chaining.
      • addDomain

        public IntegerVariableProto.Builder addDomain​(long value)
         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.
         
        repeated int64 domain = 2;
        Parameters:
        value - The domain to add.
        Returns:
        This builder for chaining.
      • addAllDomain

        public IntegerVariableProto.Builder addAllDomain​(java.lang.Iterable<? extends java.lang.Long> values)
         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.
         
        repeated int64 domain = 2;
        Parameters:
        values - The domain to add.
        Returns:
        This builder for chaining.
      • clearDomain

        public IntegerVariableProto.Builder clearDomain()
         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.
         
        repeated int64 domain = 2;
        Returns:
        This builder for chaining.
      • setUnknownFields

        public final IntegerVariableProto.Builder setUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        setUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<IntegerVariableProto.Builder>
      • mergeUnknownFields

        public final IntegerVariableProto.Builder mergeUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        mergeUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<IntegerVariableProto.Builder>