public static final class MPSosConstraint.Builder extends com.google.protobuf.GeneratedMessage.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 type
operations_research.MPSosConstraint
Modifier and Type | Method and Description |
---|---|
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.
|
MPSosConstraint.Builder |
addAllWeight(java.lang.Iterable<? extends java.lang.Double> values)
Optional: SOS weights.
|
MPSosConstraint.Builder |
addVarIndex(int value)
Variable index (w.r.t. the "variable" field of MPModelProto) of the
variables in the SOS.
|
MPSosConstraint.Builder |
addWeight(double value)
Optional: SOS weights.
|
MPSosConstraint |
build() |
MPSosConstraint |
buildPartial() |
MPSosConstraint.Builder |
clear() |
MPSosConstraint.Builder |
clearType()
optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT]; |
MPSosConstraint.Builder |
clearVarIndex()
Variable index (w.r.t. the "variable" field of MPModelProto) of the
variables in the SOS.
|
MPSosConstraint.Builder |
clearWeight()
Optional: SOS weights.
|
MPSosConstraint |
getDefaultInstanceForType() |
static com.google.protobuf.Descriptors.Descriptor |
getDescriptor() |
com.google.protobuf.Descriptors.Descriptor |
getDescriptorForType() |
MPSosConstraint.Type |
getType()
optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT]; |
int |
getVarIndex(int index)
Variable index (w.r.t. the "variable" field of MPModelProto) of the
variables in the SOS.
|
int |
getVarIndexCount()
Variable index (w.r.t. the "variable" field of MPModelProto) of the
variables in the SOS.
|
java.util.List<java.lang.Integer> |
getVarIndexList()
Variable index (w.r.t. the "variable" field of MPModelProto) of the
variables in the SOS.
|
double |
getWeight(int index)
Optional: SOS weights.
|
int |
getWeightCount()
Optional: SOS weights.
|
java.util.List<java.lang.Double> |
getWeightList()
Optional: SOS weights.
|
boolean |
hasType()
optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT]; |
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable |
internalGetFieldAccessorTable() |
boolean |
isInitialized() |
MPSosConstraint.Builder |
mergeFrom(com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
MPSosConstraint.Builder |
mergeFrom(com.google.protobuf.Message other) |
MPSosConstraint.Builder |
mergeFrom(MPSosConstraint other) |
MPSosConstraint.Builder |
setType(MPSosConstraint.Type value)
optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT]; |
MPSosConstraint.Builder |
setVarIndex(int index,
int value)
Variable index (w.r.t. the "variable" field of MPModelProto) of the
variables in the SOS.
|
MPSosConstraint.Builder |
setWeight(int index,
double value)
Optional: SOS weights.
|
addRepeatedField, clearField, clearOneof, clone, getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, internalGetMutableMapField, internalGetMutableMapFieldReflection, isClean, markClean, mergeUnknownFields, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setField, setRepeatedField, setUnknownFields, setUnknownFieldSetBuilder, setUnknownFieldsProto3
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toString
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, newUninitializedMessageException
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable
in class com.google.protobuf.GeneratedMessage.Builder<MPSosConstraint.Builder>
public MPSosConstraint.Builder clear()
clear
in interface com.google.protobuf.Message.Builder
clear
in interface com.google.protobuf.MessageLite.Builder
clear
in class com.google.protobuf.GeneratedMessage.Builder<MPSosConstraint.Builder>
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
getDescriptorForType
in interface com.google.protobuf.Message.Builder
getDescriptorForType
in interface com.google.protobuf.MessageOrBuilder
getDescriptorForType
in class com.google.protobuf.GeneratedMessage.Builder<MPSosConstraint.Builder>
public MPSosConstraint getDefaultInstanceForType()
getDefaultInstanceForType
in interface com.google.protobuf.MessageLiteOrBuilder
getDefaultInstanceForType
in interface com.google.protobuf.MessageOrBuilder
public MPSosConstraint build()
build
in interface com.google.protobuf.Message.Builder
build
in interface com.google.protobuf.MessageLite.Builder
public MPSosConstraint buildPartial()
buildPartial
in interface com.google.protobuf.Message.Builder
buildPartial
in interface com.google.protobuf.MessageLite.Builder
public MPSosConstraint.Builder mergeFrom(com.google.protobuf.Message other)
mergeFrom
in interface com.google.protobuf.Message.Builder
mergeFrom
in class com.google.protobuf.AbstractMessage.Builder<MPSosConstraint.Builder>
public MPSosConstraint.Builder mergeFrom(MPSosConstraint other)
public final boolean isInitialized()
isInitialized
in interface com.google.protobuf.MessageLiteOrBuilder
isInitialized
in class com.google.protobuf.GeneratedMessage.Builder<MPSosConstraint.Builder>
public MPSosConstraint.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
mergeFrom
in interface com.google.protobuf.Message.Builder
mergeFrom
in interface com.google.protobuf.MessageLite.Builder
mergeFrom
in class com.google.protobuf.AbstractMessage.Builder<MPSosConstraint.Builder>
java.io.IOException
public boolean hasType()
optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT];
hasType
in interface MPSosConstraintOrBuilder
public MPSosConstraint.Type getType()
optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT];
getType
in interface MPSosConstraintOrBuilder
public MPSosConstraint.Builder setType(MPSosConstraint.Type value)
optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT];
value
- The type to set.public MPSosConstraint.Builder clearType()
optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT];
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;
getVarIndexList
in interface MPSosConstraintOrBuilder
public int getVarIndexCount()
Variable index (w.r.t. the "variable" field of MPModelProto) of the variables in the SOS.
repeated int32 var_index = 2;
getVarIndexCount
in interface MPSosConstraintOrBuilder
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;
getVarIndex
in interface MPSosConstraintOrBuilder
index
- The index of the element to return.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;
index
- The index to set the value at.value
- The varIndex to set.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;
value
- The varIndex to add.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;
values
- The varIndex to add.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;
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;
getWeightList
in interface MPSosConstraintOrBuilder
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;
getWeightCount
in interface MPSosConstraintOrBuilder
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;
getWeight
in interface MPSosConstraintOrBuilder
index
- The index of the element to return.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;
index
- The index to set the value at.value
- The weight to set.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;
value
- The weight to add.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;
values
- The weight to add.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;
Copyright © 2025. All rights reserved.