Package com.google.ortools.linearsolver
Class MPSosConstraint.Builder
- java.lang.Object
-
- com.google.protobuf.AbstractMessageLite.Builder
-
- com.google.protobuf.AbstractMessage.Builder<BuilderT>
-
- com.google.protobuf.GeneratedMessageV3.Builder<MPSosConstraint.Builder>
-
- com.google.ortools.linearsolver.MPSosConstraint.Builder
-
- All Implemented Interfaces:
MPSosConstraintOrBuilder,com.google.protobuf.Message.Builder,com.google.protobuf.MessageLite.Builder,com.google.protobuf.MessageLiteOrBuilder,com.google.protobuf.MessageOrBuilder,java.lang.Cloneable
- Enclosing class:
- MPSosConstraint
public static final class MPSosConstraint.Builder extends com.google.protobuf.GeneratedMessageV3.Builder<MPSosConstraint.Builder> implements MPSosConstraintOrBuilder
Special Ordered Set (SOS) constraints of type 1 or 2. See https://en.wikipedia.org/wiki/Special_ordered_set As of 2019/04, only SCIP and Gurobi support this constraint type.
Protobuf typeoperations_research.MPSosConstraint
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MPSosConstraint.BuilderaddAllVarIndex(java.lang.Iterable<? extends java.lang.Integer> values)Variable index (w.r.t.MPSosConstraint.BuilderaddAllWeight(java.lang.Iterable<? extends java.lang.Double> values)Optional: SOS weights.MPSosConstraint.BuilderaddRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)MPSosConstraint.BuilderaddVarIndex(int value)Variable index (w.r.t.MPSosConstraint.BuilderaddWeight(double value)Optional: SOS weights.MPSosConstraintbuild()MPSosConstraintbuildPartial()MPSosConstraint.Builderclear()MPSosConstraint.BuilderclearField(com.google.protobuf.Descriptors.FieldDescriptor field)MPSosConstraint.BuilderclearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)MPSosConstraint.BuilderclearType()optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT];MPSosConstraint.BuilderclearVarIndex()Variable index (w.r.t.MPSosConstraint.BuilderclearWeight()Optional: SOS weights.MPSosConstraint.Builderclone()MPSosConstraintgetDefaultInstanceForType()static com.google.protobuf.Descriptors.DescriptorgetDescriptor()com.google.protobuf.Descriptors.DescriptorgetDescriptorForType()MPSosConstraint.TypegetType()optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT];intgetVarIndex(int index)Variable index (w.r.t.intgetVarIndexCount()Variable index (w.r.t.java.util.List<java.lang.Integer>getVarIndexList()Variable index (w.r.t.doublegetWeight(int index)Optional: SOS weights.intgetWeightCount()Optional: SOS weights.java.util.List<java.lang.Double>getWeightList()Optional: SOS weights.booleanhasType()optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT];protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTableinternalGetFieldAccessorTable()booleanisInitialized()MPSosConstraint.BuildermergeFrom(MPSosConstraint other)MPSosConstraint.BuildermergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)MPSosConstraint.BuildermergeFrom(com.google.protobuf.Message other)MPSosConstraint.BuildermergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)MPSosConstraint.BuildersetField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)MPSosConstraint.BuildersetRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)MPSosConstraint.BuildersetType(MPSosConstraint.Type value)optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT];MPSosConstraint.BuildersetUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)MPSosConstraint.BuildersetVarIndex(int index, int value)Variable index (w.r.t.MPSosConstraint.BuildersetWeight(int index, double value)Optional: SOS weights.-
Methods inherited from class com.google.protobuf.GeneratedMessageV3.Builder
getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, internalGetMutableMapField, internalGetMutableMapFieldReflection, isClean, markClean, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setUnknownFieldSetBuilder, setUnknownFieldsProto3
-
Methods inherited from class com.google.protobuf.AbstractMessage.Builder
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toString
-
Methods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageException
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Method Detail
-
getDescriptor
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
-
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
- Specified by:
internalGetFieldAccessorTablein classcom.google.protobuf.GeneratedMessageV3.Builder<MPSosConstraint.Builder>
-
clear
public MPSosConstraint.Builder clear()
- Specified by:
clearin interfacecom.google.protobuf.Message.Builder- Specified by:
clearin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clearin classcom.google.protobuf.GeneratedMessageV3.Builder<MPSosConstraint.Builder>
-
getDescriptorForType
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.Message.Builder- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.MessageOrBuilder- Overrides:
getDescriptorForTypein classcom.google.protobuf.GeneratedMessageV3.Builder<MPSosConstraint.Builder>
-
getDefaultInstanceForType
public MPSosConstraint getDefaultInstanceForType()
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-
build
public MPSosConstraint build()
- Specified by:
buildin interfacecom.google.protobuf.Message.Builder- Specified by:
buildin interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
public MPSosConstraint buildPartial()
- Specified by:
buildPartialin interfacecom.google.protobuf.Message.Builder- Specified by:
buildPartialin interfacecom.google.protobuf.MessageLite.Builder
-
clone
public MPSosConstraint.Builder clone()
- Specified by:
clonein interfacecom.google.protobuf.Message.Builder- Specified by:
clonein interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clonein classcom.google.protobuf.GeneratedMessageV3.Builder<MPSosConstraint.Builder>
-
setField
public MPSosConstraint.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)
- Specified by:
setFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<MPSosConstraint.Builder>
-
clearField
public MPSosConstraint.Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field)
- Specified by:
clearFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
clearFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<MPSosConstraint.Builder>
-
clearOneof
public MPSosConstraint.Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)
- Specified by:
clearOneofin interfacecom.google.protobuf.Message.Builder- Overrides:
clearOneofin classcom.google.protobuf.GeneratedMessageV3.Builder<MPSosConstraint.Builder>
-
setRepeatedField
public MPSosConstraint.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)
- Specified by:
setRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<MPSosConstraint.Builder>
-
addRepeatedField
public MPSosConstraint.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)
- Specified by:
addRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
addRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<MPSosConstraint.Builder>
-
mergeFrom
public MPSosConstraint.Builder mergeFrom(com.google.protobuf.Message other)
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<MPSosConstraint.Builder>
-
mergeFrom
public MPSosConstraint.Builder mergeFrom(MPSosConstraint other)
-
isInitialized
public final boolean isInitialized()
- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.google.protobuf.GeneratedMessageV3.Builder<MPSosConstraint.Builder>
-
mergeFrom
public MPSosConstraint.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Specified by:
mergeFromin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<MPSosConstraint.Builder>- Throws:
java.io.IOException
-
hasType
public boolean hasType()
optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT];- Specified by:
hasTypein interfaceMPSosConstraintOrBuilder- Returns:
- Whether the type field is set.
-
getType
public MPSosConstraint.Type getType()
optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT];- Specified by:
getTypein interfaceMPSosConstraintOrBuilder- Returns:
- The type.
-
setType
public MPSosConstraint.Builder setType(MPSosConstraint.Type value)
optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT];- Parameters:
value- The type to set.- Returns:
- This builder for chaining.
-
clearType
public MPSosConstraint.Builder clearType()
optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT];- Returns:
- This builder for chaining.
-
getVarIndexList
public java.util.List<java.lang.Integer> getVarIndexList()
Variable index (w.r.t. the "variable" field of MPModelProto) of the variables in the SOS.
repeated int32 var_index = 2;- Specified by:
getVarIndexListin interfaceMPSosConstraintOrBuilder- Returns:
- A list containing the varIndex.
-
getVarIndexCount
public int getVarIndexCount()
Variable index (w.r.t. the "variable" field of MPModelProto) of the variables in the SOS.
repeated int32 var_index = 2;- Specified by:
getVarIndexCountin interfaceMPSosConstraintOrBuilder- Returns:
- The count of varIndex.
-
getVarIndex
public int getVarIndex(int index)
Variable index (w.r.t. the "variable" field of MPModelProto) of the variables in the SOS.
repeated int32 var_index = 2;- Specified by:
getVarIndexin interfaceMPSosConstraintOrBuilder- Parameters:
index- The index of the element to return.- Returns:
- The varIndex at the given index.
-
setVarIndex
public MPSosConstraint.Builder setVarIndex(int index, int value)
Variable index (w.r.t. the "variable" field of MPModelProto) of the variables in the SOS.
repeated int32 var_index = 2;- Parameters:
index- The index to set the value at.value- The varIndex to set.- Returns:
- This builder for chaining.
-
addVarIndex
public MPSosConstraint.Builder addVarIndex(int value)
Variable index (w.r.t. the "variable" field of MPModelProto) of the variables in the SOS.
repeated int32 var_index = 2;- Parameters:
value- The varIndex to add.- Returns:
- This builder for chaining.
-
addAllVarIndex
public MPSosConstraint.Builder addAllVarIndex(java.lang.Iterable<? extends java.lang.Integer> values)
Variable index (w.r.t. the "variable" field of MPModelProto) of the variables in the SOS.
repeated int32 var_index = 2;- Parameters:
values- The varIndex to add.- Returns:
- This builder for chaining.
-
clearVarIndex
public MPSosConstraint.Builder clearVarIndex()
Variable index (w.r.t. the "variable" field of MPModelProto) of the variables in the SOS.
repeated int32 var_index = 2;- Returns:
- This builder for chaining.
-
getWeightList
public java.util.List<java.lang.Double> getWeightList()
Optional: SOS weights. If non-empty, must be of the same size as "var_index", and strictly increasing. If empty and required by the underlying solver, the 1..n sequence will be given as weights. SUBTLE: The weights can help the solver make branch-and-bound decisions that fit the underlying optimization model: after each LP relaxation, it will compute the "average weight" of the SOS variables, weighted by value (this is confusing: here we're using the values as weights), and the binary branch decision will be: is the non-zero variable above or below that? (weights are strictly monotonous, so the "cutoff" average weight corresponds to a "cutoff" index in the var_index sequence).
repeated double weight = 3;- Specified by:
getWeightListin interfaceMPSosConstraintOrBuilder- Returns:
- A list containing the weight.
-
getWeightCount
public int getWeightCount()
Optional: SOS weights. If non-empty, must be of the same size as "var_index", and strictly increasing. If empty and required by the underlying solver, the 1..n sequence will be given as weights. SUBTLE: The weights can help the solver make branch-and-bound decisions that fit the underlying optimization model: after each LP relaxation, it will compute the "average weight" of the SOS variables, weighted by value (this is confusing: here we're using the values as weights), and the binary branch decision will be: is the non-zero variable above or below that? (weights are strictly monotonous, so the "cutoff" average weight corresponds to a "cutoff" index in the var_index sequence).
repeated double weight = 3;- Specified by:
getWeightCountin interfaceMPSosConstraintOrBuilder- Returns:
- The count of weight.
-
getWeight
public double getWeight(int index)
Optional: SOS weights. If non-empty, must be of the same size as "var_index", and strictly increasing. If empty and required by the underlying solver, the 1..n sequence will be given as weights. SUBTLE: The weights can help the solver make branch-and-bound decisions that fit the underlying optimization model: after each LP relaxation, it will compute the "average weight" of the SOS variables, weighted by value (this is confusing: here we're using the values as weights), and the binary branch decision will be: is the non-zero variable above or below that? (weights are strictly monotonous, so the "cutoff" average weight corresponds to a "cutoff" index in the var_index sequence).
repeated double weight = 3;- Specified by:
getWeightin interfaceMPSosConstraintOrBuilder- Parameters:
index- The index of the element to return.- Returns:
- The weight at the given index.
-
setWeight
public MPSosConstraint.Builder setWeight(int index, double value)
Optional: SOS weights. If non-empty, must be of the same size as "var_index", and strictly increasing. If empty and required by the underlying solver, the 1..n sequence will be given as weights. SUBTLE: The weights can help the solver make branch-and-bound decisions that fit the underlying optimization model: after each LP relaxation, it will compute the "average weight" of the SOS variables, weighted by value (this is confusing: here we're using the values as weights), and the binary branch decision will be: is the non-zero variable above or below that? (weights are strictly monotonous, so the "cutoff" average weight corresponds to a "cutoff" index in the var_index sequence).
repeated double weight = 3;- Parameters:
index- The index to set the value at.value- The weight to set.- Returns:
- This builder for chaining.
-
addWeight
public MPSosConstraint.Builder addWeight(double value)
Optional: SOS weights. If non-empty, must be of the same size as "var_index", and strictly increasing. If empty and required by the underlying solver, the 1..n sequence will be given as weights. SUBTLE: The weights can help the solver make branch-and-bound decisions that fit the underlying optimization model: after each LP relaxation, it will compute the "average weight" of the SOS variables, weighted by value (this is confusing: here we're using the values as weights), and the binary branch decision will be: is the non-zero variable above or below that? (weights are strictly monotonous, so the "cutoff" average weight corresponds to a "cutoff" index in the var_index sequence).
repeated double weight = 3;- Parameters:
value- The weight to add.- Returns:
- This builder for chaining.
-
addAllWeight
public MPSosConstraint.Builder addAllWeight(java.lang.Iterable<? extends java.lang.Double> values)
Optional: SOS weights. If non-empty, must be of the same size as "var_index", and strictly increasing. If empty and required by the underlying solver, the 1..n sequence will be given as weights. SUBTLE: The weights can help the solver make branch-and-bound decisions that fit the underlying optimization model: after each LP relaxation, it will compute the "average weight" of the SOS variables, weighted by value (this is confusing: here we're using the values as weights), and the binary branch decision will be: is the non-zero variable above or below that? (weights are strictly monotonous, so the "cutoff" average weight corresponds to a "cutoff" index in the var_index sequence).
repeated double weight = 3;- Parameters:
values- The weight to add.- Returns:
- This builder for chaining.
-
clearWeight
public MPSosConstraint.Builder clearWeight()
Optional: SOS weights. If non-empty, must be of the same size as "var_index", and strictly increasing. If empty and required by the underlying solver, the 1..n sequence will be given as weights. SUBTLE: The weights can help the solver make branch-and-bound decisions that fit the underlying optimization model: after each LP relaxation, it will compute the "average weight" of the SOS variables, weighted by value (this is confusing: here we're using the values as weights), and the binary branch decision will be: is the non-zero variable above or below that? (weights are strictly monotonous, so the "cutoff" average weight corresponds to a "cutoff" index in the var_index sequence).
repeated double weight = 3;- Returns:
- This builder for chaining.
-
setUnknownFields
public final MPSosConstraint.Builder setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
- Specified by:
setUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
setUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<MPSosConstraint.Builder>
-
mergeUnknownFields
public final MPSosConstraint.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
- Specified by:
mergeUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<MPSosConstraint.Builder>
-
-