Class CpModelProto

  • All Implemented Interfaces:
    CpModelProtoOrBuilder, com.google.protobuf.Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, java.io.Serializable

    public final class CpModelProto
    extends com.google.protobuf.GeneratedMessageV3
    implements CpModelProtoOrBuilder
     A constraint programming problem.
     
    Protobuf type operations_research.sat.CpModelProto
    See Also:
    Serialized Form
    • Method Detail

      • newInstance

        protected java.lang.Object newInstance​(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
        Overrides:
        newInstance in class com.google.protobuf.GeneratedMessageV3
      • 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
      • getName

        public java.lang.String getName()
         For debug/logging only. Can be empty.
         
        string name = 1;
        Specified by:
        getName in interface CpModelProtoOrBuilder
        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 CpModelProtoOrBuilder
        Returns:
        The bytes for name.
      • getVariablesList

        public java.util.List<IntegerVariableProto> getVariablesList()
         The associated Protos should be referred by their index in these fields.
         
        repeated .operations_research.sat.IntegerVariableProto variables = 2;
        Specified by:
        getVariablesList in interface CpModelProtoOrBuilder
      • getVariablesCount

        public int getVariablesCount()
         The associated Protos should be referred by their index in these fields.
         
        repeated .operations_research.sat.IntegerVariableProto variables = 2;
        Specified by:
        getVariablesCount in interface CpModelProtoOrBuilder
      • getVariables

        public IntegerVariableProto getVariables​(int index)
         The associated Protos should be referred by their index in these fields.
         
        repeated .operations_research.sat.IntegerVariableProto variables = 2;
        Specified by:
        getVariables in interface CpModelProtoOrBuilder
      • hasObjective

        public boolean hasObjective()
         The objective to minimize. Can be empty for pure decision problems.
         
        .operations_research.sat.CpObjectiveProto objective = 4;
        Specified by:
        hasObjective in interface CpModelProtoOrBuilder
        Returns:
        Whether the objective field is set.
      • getObjective

        public CpObjectiveProto getObjective()
         The objective to minimize. Can be empty for pure decision problems.
         
        .operations_research.sat.CpObjectiveProto objective = 4;
        Specified by:
        getObjective in interface CpModelProtoOrBuilder
        Returns:
        The objective.
      • hasFloatingPointObjective

        public boolean hasFloatingPointObjective()
         Advanced usage.
         It is invalid to have both an objective and a floating point objective.
        
         The objective of the model, in floating point format. The solver will
         automatically scale this to integer during expansion and thus convert it to
         a normal CpObjectiveProto. See the mip* parameters to control how this is
         scaled. In most situation the precision will be good enough, but you can
         see the logs to see what are the precision guaranteed when this is
         converted to a fixed point representation.
        
         Note that even if the precision is bad, the returned objective_value and
         best_objective_bound will be computed correctly. So at the end of the solve
         you can check the gap if you only want precise optimal.
         
        .operations_research.sat.FloatObjectiveProto floating_point_objective = 9;
        Specified by:
        hasFloatingPointObjective in interface CpModelProtoOrBuilder
        Returns:
        Whether the floatingPointObjective field is set.
      • getFloatingPointObjective

        public FloatObjectiveProto getFloatingPointObjective()
         Advanced usage.
         It is invalid to have both an objective and a floating point objective.
        
         The objective of the model, in floating point format. The solver will
         automatically scale this to integer during expansion and thus convert it to
         a normal CpObjectiveProto. See the mip* parameters to control how this is
         scaled. In most situation the precision will be good enough, but you can
         see the logs to see what are the precision guaranteed when this is
         converted to a fixed point representation.
        
         Note that even if the precision is bad, the returned objective_value and
         best_objective_bound will be computed correctly. So at the end of the solve
         you can check the gap if you only want precise optimal.
         
        .operations_research.sat.FloatObjectiveProto floating_point_objective = 9;
        Specified by:
        getFloatingPointObjective in interface CpModelProtoOrBuilder
        Returns:
        The floatingPointObjective.
      • getFloatingPointObjectiveOrBuilder

        public FloatObjectiveProtoOrBuilder getFloatingPointObjectiveOrBuilder()
         Advanced usage.
         It is invalid to have both an objective and a floating point objective.
        
         The objective of the model, in floating point format. The solver will
         automatically scale this to integer during expansion and thus convert it to
         a normal CpObjectiveProto. See the mip* parameters to control how this is
         scaled. In most situation the precision will be good enough, but you can
         see the logs to see what are the precision guaranteed when this is
         converted to a fixed point representation.
        
         Note that even if the precision is bad, the returned objective_value and
         best_objective_bound will be computed correctly. So at the end of the solve
         you can check the gap if you only want precise optimal.
         
        .operations_research.sat.FloatObjectiveProto floating_point_objective = 9;
        Specified by:
        getFloatingPointObjectiveOrBuilder in interface CpModelProtoOrBuilder
      • getSearchStrategyList

        public java.util.List<DecisionStrategyProto> getSearchStrategyList()
         Defines the strategy that the solver should follow when the
         search_branching parameter is set to FIXED_SEARCH. Note that this strategy
         is also used as a heuristic when we are not in fixed search.
        
         Advanced Usage: if not all variables appears and the parameter
         "instantiate_all_variables" is set to false, then the solver will not try
         to instantiate the variables that do not appear. Thus, at the end of the
         search, not all variables may be fixed. Currently, we will set them to
         their lower bound in the solution.
         
        repeated .operations_research.sat.DecisionStrategyProto search_strategy = 5;
        Specified by:
        getSearchStrategyList in interface CpModelProtoOrBuilder
      • getSearchStrategyOrBuilderList

        public java.util.List<? extends DecisionStrategyProtoOrBuilder> getSearchStrategyOrBuilderList()
         Defines the strategy that the solver should follow when the
         search_branching parameter is set to FIXED_SEARCH. Note that this strategy
         is also used as a heuristic when we are not in fixed search.
        
         Advanced Usage: if not all variables appears and the parameter
         "instantiate_all_variables" is set to false, then the solver will not try
         to instantiate the variables that do not appear. Thus, at the end of the
         search, not all variables may be fixed. Currently, we will set them to
         their lower bound in the solution.
         
        repeated .operations_research.sat.DecisionStrategyProto search_strategy = 5;
        Specified by:
        getSearchStrategyOrBuilderList in interface CpModelProtoOrBuilder
      • getSearchStrategyCount

        public int getSearchStrategyCount()
         Defines the strategy that the solver should follow when the
         search_branching parameter is set to FIXED_SEARCH. Note that this strategy
         is also used as a heuristic when we are not in fixed search.
        
         Advanced Usage: if not all variables appears and the parameter
         "instantiate_all_variables" is set to false, then the solver will not try
         to instantiate the variables that do not appear. Thus, at the end of the
         search, not all variables may be fixed. Currently, we will set them to
         their lower bound in the solution.
         
        repeated .operations_research.sat.DecisionStrategyProto search_strategy = 5;
        Specified by:
        getSearchStrategyCount in interface CpModelProtoOrBuilder
      • getSearchStrategy

        public DecisionStrategyProto getSearchStrategy​(int index)
         Defines the strategy that the solver should follow when the
         search_branching parameter is set to FIXED_SEARCH. Note that this strategy
         is also used as a heuristic when we are not in fixed search.
        
         Advanced Usage: if not all variables appears and the parameter
         "instantiate_all_variables" is set to false, then the solver will not try
         to instantiate the variables that do not appear. Thus, at the end of the
         search, not all variables may be fixed. Currently, we will set them to
         their lower bound in the solution.
         
        repeated .operations_research.sat.DecisionStrategyProto search_strategy = 5;
        Specified by:
        getSearchStrategy in interface CpModelProtoOrBuilder
      • getSearchStrategyOrBuilder

        public DecisionStrategyProtoOrBuilder getSearchStrategyOrBuilder​(int index)
         Defines the strategy that the solver should follow when the
         search_branching parameter is set to FIXED_SEARCH. Note that this strategy
         is also used as a heuristic when we are not in fixed search.
        
         Advanced Usage: if not all variables appears and the parameter
         "instantiate_all_variables" is set to false, then the solver will not try
         to instantiate the variables that do not appear. Thus, at the end of the
         search, not all variables may be fixed. Currently, we will set them to
         their lower bound in the solution.
         
        repeated .operations_research.sat.DecisionStrategyProto search_strategy = 5;
        Specified by:
        getSearchStrategyOrBuilder in interface CpModelProtoOrBuilder
      • hasSolutionHint

        public boolean hasSolutionHint()
         Solution hint.
        
         If a feasible or almost-feasible solution to the problem is already known,
         it may be helpful to pass it to the solver so that it can be used. The
         solver will try to use this information to create its initial feasible
         solution.
        
         Note that it may not always be faster to give a hint like this to the
         solver. There is also no guarantee that the solver will use this hint or
         try to return a solution "close" to this assignment in case of multiple
         optimal solutions.
         
        .operations_research.sat.PartialVariableAssignment solution_hint = 6;
        Specified by:
        hasSolutionHint in interface CpModelProtoOrBuilder
        Returns:
        Whether the solutionHint field is set.
      • getSolutionHint

        public PartialVariableAssignment getSolutionHint()
         Solution hint.
        
         If a feasible or almost-feasible solution to the problem is already known,
         it may be helpful to pass it to the solver so that it can be used. The
         solver will try to use this information to create its initial feasible
         solution.
        
         Note that it may not always be faster to give a hint like this to the
         solver. There is also no guarantee that the solver will use this hint or
         try to return a solution "close" to this assignment in case of multiple
         optimal solutions.
         
        .operations_research.sat.PartialVariableAssignment solution_hint = 6;
        Specified by:
        getSolutionHint in interface CpModelProtoOrBuilder
        Returns:
        The solutionHint.
      • getSolutionHintOrBuilder

        public PartialVariableAssignmentOrBuilder getSolutionHintOrBuilder()
         Solution hint.
        
         If a feasible or almost-feasible solution to the problem is already known,
         it may be helpful to pass it to the solver so that it can be used. The
         solver will try to use this information to create its initial feasible
         solution.
        
         Note that it may not always be faster to give a hint like this to the
         solver. There is also no guarantee that the solver will use this hint or
         try to return a solution "close" to this assignment in case of multiple
         optimal solutions.
         
        .operations_research.sat.PartialVariableAssignment solution_hint = 6;
        Specified by:
        getSolutionHintOrBuilder in interface CpModelProtoOrBuilder
      • getAssumptionsList

        public java.util.List<java.lang.Integer> getAssumptionsList()
         A list of literals. The model will be solved assuming all these literals
         are true. Compared to just fixing the domain of these literals, using this
         mechanism is slower but allows in case the model is INFEASIBLE to get a
         potentially small subset of them that can be used to explain the
         infeasibility.
        
         Think (IIS), except when you are only concerned by the provided
         assumptions. This is powerful as it allows to group a set of logically
         related constraint under only one enforcement literal which can potentially
         give you a good and interpretable explanation for infeasiblity.
        
         Such infeasibility explanation will be available in the
         sufficient_assumptions_for_infeasibility response field.
         
        repeated int32 assumptions = 7;
        Specified by:
        getAssumptionsList in interface CpModelProtoOrBuilder
        Returns:
        A list containing the assumptions.
      • getAssumptionsCount

        public int getAssumptionsCount()
         A list of literals. The model will be solved assuming all these literals
         are true. Compared to just fixing the domain of these literals, using this
         mechanism is slower but allows in case the model is INFEASIBLE to get a
         potentially small subset of them that can be used to explain the
         infeasibility.
        
         Think (IIS), except when you are only concerned by the provided
         assumptions. This is powerful as it allows to group a set of logically
         related constraint under only one enforcement literal which can potentially
         give you a good and interpretable explanation for infeasiblity.
        
         Such infeasibility explanation will be available in the
         sufficient_assumptions_for_infeasibility response field.
         
        repeated int32 assumptions = 7;
        Specified by:
        getAssumptionsCount in interface CpModelProtoOrBuilder
        Returns:
        The count of assumptions.
      • getAssumptions

        public int getAssumptions​(int index)
         A list of literals. The model will be solved assuming all these literals
         are true. Compared to just fixing the domain of these literals, using this
         mechanism is slower but allows in case the model is INFEASIBLE to get a
         potentially small subset of them that can be used to explain the
         infeasibility.
        
         Think (IIS), except when you are only concerned by the provided
         assumptions. This is powerful as it allows to group a set of logically
         related constraint under only one enforcement literal which can potentially
         give you a good and interpretable explanation for infeasiblity.
        
         Such infeasibility explanation will be available in the
         sufficient_assumptions_for_infeasibility response field.
         
        repeated int32 assumptions = 7;
        Specified by:
        getAssumptions in interface CpModelProtoOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The assumptions at the given index.
      • hasSymmetry

        public boolean hasSymmetry()
         For now, this is not meant to be filled by a client writing a model, but
         by our preprocessing step.
        
         Information about the symmetries of the feasible solution space.
         These usually leaves the objective invariant.
         
        .operations_research.sat.SymmetryProto symmetry = 8;
        Specified by:
        hasSymmetry in interface CpModelProtoOrBuilder
        Returns:
        Whether the symmetry field is set.
      • getSymmetry

        public SymmetryProto getSymmetry()
         For now, this is not meant to be filled by a client writing a model, but
         by our preprocessing step.
        
         Information about the symmetries of the feasible solution space.
         These usually leaves the objective invariant.
         
        .operations_research.sat.SymmetryProto symmetry = 8;
        Specified by:
        getSymmetry in interface CpModelProtoOrBuilder
        Returns:
        The symmetry.
      • getSymmetryOrBuilder

        public SymmetryProtoOrBuilder getSymmetryOrBuilder()
         For now, this is not meant to be filled by a client writing a model, but
         by our preprocessing step.
        
         Information about the symmetries of the feasible solution space.
         These usually leaves the objective invariant.
         
        .operations_research.sat.SymmetryProto symmetry = 8;
        Specified by:
        getSymmetryOrBuilder in interface CpModelProtoOrBuilder
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3
      • writeTo

        public void writeTo​(com.google.protobuf.CodedOutputStream output)
                     throws java.io.IOException
        Specified by:
        writeTo in interface com.google.protobuf.MessageLite
        Overrides:
        writeTo in class com.google.protobuf.GeneratedMessageV3
        Throws:
        java.io.IOException
      • getSerializedSize

        public int getSerializedSize()
        Specified by:
        getSerializedSize in interface com.google.protobuf.MessageLite
        Overrides:
        getSerializedSize in class com.google.protobuf.GeneratedMessageV3
      • equals

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in interface com.google.protobuf.Message
        Overrides:
        equals in class com.google.protobuf.AbstractMessage
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface com.google.protobuf.Message
        Overrides:
        hashCode in class com.google.protobuf.AbstractMessage
      • parseFrom

        public static CpModelProto parseFrom​(java.nio.ByteBuffer data)
                                      throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static CpModelProto parseFrom​(java.nio.ByteBuffer data,
                                             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                      throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static CpModelProto parseFrom​(com.google.protobuf.ByteString data)
                                      throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static CpModelProto parseFrom​(com.google.protobuf.ByteString data,
                                             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                      throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static CpModelProto parseFrom​(byte[] data)
                                      throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static CpModelProto parseFrom​(byte[] data,
                                             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                      throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static CpModelProto parseFrom​(java.io.InputStream input)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • parseFrom

        public static CpModelProto parseFrom​(java.io.InputStream input,
                                             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • parseDelimitedFrom

        public static CpModelProto parseDelimitedFrom​(java.io.InputStream input)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • parseDelimitedFrom

        public static CpModelProto parseDelimitedFrom​(java.io.InputStream input,
                                                      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • parseFrom

        public static CpModelProto parseFrom​(com.google.protobuf.CodedInputStream input)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • parseFrom

        public static CpModelProto parseFrom​(com.google.protobuf.CodedInputStream input,
                                             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • newBuilderForType

        public CpModelProto.Builder newBuilderForType()
        Specified by:
        newBuilderForType in interface com.google.protobuf.Message
        Specified by:
        newBuilderForType in interface com.google.protobuf.MessageLite
      • toBuilder

        public CpModelProto.Builder toBuilder()
        Specified by:
        toBuilder in interface com.google.protobuf.Message
        Specified by:
        toBuilder in interface com.google.protobuf.MessageLite
      • newBuilderForType

        protected CpModelProto.Builder newBuilderForType​(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
        Specified by:
        newBuilderForType in class com.google.protobuf.GeneratedMessageV3
      • getDefaultInstance

        public static CpModelProto getDefaultInstance()
      • parser

        public static com.google.protobuf.Parser<CpModelProto> parser()
      • getParserForType

        public com.google.protobuf.Parser<CpModelProto> getParserForType()
        Specified by:
        getParserForType in interface com.google.protobuf.Message
        Specified by:
        getParserForType in interface com.google.protobuf.MessageLite
        Overrides:
        getParserForType in class com.google.protobuf.GeneratedMessageV3
      • getDefaultInstanceForType

        public CpModelProto getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder