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
Definition at line 598 of file MPSosConstraint.java.
|
| static final com.google.protobuf.Descriptors.Descriptor | getDescriptor () |
| |
◆ addAllVarIndex()
| Builder addAllVarIndex |
( |
java.lang.Iterable<? extends java.lang.Integer > |
values | ) |
|
|
inline |
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.
Definition at line 916 of file MPSosConstraint.java.
◆ addAllWeight()
| Builder addAllWeight |
( |
java.lang.Iterable<? extends java.lang.Double > |
values | ) |
|
|
inline |
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
-
- Returns
- This builder for chaining.
Definition at line 1078 of file MPSosConstraint.java.
◆ addRepeatedField()
| .lang.Override Builder addRepeatedField |
( |
com.google.protobuf.Descriptors.FieldDescriptor |
field, |
|
|
java.lang.Object |
value |
|
) |
| |
|
inline |
◆ addVarIndex()
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.
Definition at line 900 of file MPSosConstraint.java.
◆ addWeight()
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
-
- Returns
- This builder for chaining.
Definition at line 1054 of file MPSosConstraint.java.
◆ build()
◆ buildPartial()
◆ clear()
◆ clearField()
| .lang.Override Builder clearField |
( |
com.google.protobuf.Descriptors.FieldDescriptor |
field | ) |
|
|
inline |
◆ clearOneof()
| .lang.Override Builder clearOneof |
( |
com.google.protobuf.Descriptors.OneofDescriptor |
oneof | ) |
|
|
inline |
◆ clearType()
optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT];
- Returns
- This builder for chaining.
Definition at line 819 of file MPSosConstraint.java.
◆ 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.
Definition at line 933 of file MPSosConstraint.java.
◆ 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.
Definition at line 1103 of file MPSosConstraint.java.
◆ clone()
◆ getDefaultInstanceForType()
◆ getDescriptor()
| static final com.google.protobuf.Descriptors.Descriptor getDescriptor |
( |
| ) |
|
|
inlinestatic |
◆ getDescriptorForType()
| .lang.Override com.google.protobuf.Descriptors.Descriptor getDescriptorForType |
( |
| ) |
|
|
inline |
◆ getType()
◆ getVarIndex()
| int getVarIndex |
( |
int |
index | ) |
|
|
inline |
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 of the element to return. |
- Returns
- The varIndex at the given index.
Implements MPSosConstraintOrBuilder.
Definition at line 869 of file MPSosConstraint.java.
◆ getVarIndexCount()
◆ getVarIndexList()
| java.util.List<java.lang.Integer> getVarIndexList |
( |
| ) |
|
|
inline |
◆ getWeight()
| double getWeight |
( |
int |
index | ) |
|
|
inline |
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 of the element to return. |
- Returns
- The weight at the given index.
Implements MPSosConstraintOrBuilder.
Definition at line 1007 of file MPSosConstraint.java.
◆ 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;
- Returns
- The count of weight.
Implements MPSosConstraintOrBuilder.
Definition at line 986 of file MPSosConstraint.java.
◆ getWeightList()
| java.util.List<java.lang.Double> getWeightList |
( |
| ) |
|
|
inline |
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
- A list containing the weight.
Implements MPSosConstraintOrBuilder.
Definition at line 965 of file MPSosConstraint.java.
◆ hasType()
| .lang.Override boolean hasType |
( |
| ) |
|
|
inline |
◆ internalGetFieldAccessorTable()
| .lang.Override com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable |
( |
| ) |
|
|
inlineprotected |
◆ isInitialized()
| .lang.Override final boolean isInitialized |
( |
| ) |
|
|
inline |
◆ mergeFrom() [1/3]
◆ mergeFrom() [2/3]
| .lang.Override Builder mergeFrom |
( |
com.google.protobuf.CodedInputStream |
input, |
|
|
com.google.protobuf.ExtensionRegistryLite |
extensionRegistry |
|
) |
| throws java.io.IOException |
|
inline |
◆ mergeFrom() [3/3]
| .lang.Override Builder mergeFrom |
( |
com.google.protobuf.Message |
other | ) |
|
|
inline |
◆ mergeUnknownFields()
| .lang.Override final Builder mergeUnknownFields |
( |
final com.google.protobuf.UnknownFieldSet |
unknownFields | ) |
|
|
inline |
◆ setField()
| .lang.Override Builder setField |
( |
com.google.protobuf.Descriptors.FieldDescriptor |
field, |
|
|
java.lang.Object |
value |
|
) |
| |
|
inline |
◆ setRepeatedField()
| .lang.Override Builder setRepeatedField |
( |
com.google.protobuf.Descriptors.FieldDescriptor |
field, |
|
|
int |
index, |
|
|
java.lang.Object |
value |
|
) |
| |
|
inline |
◆ setType()
optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT];
- Parameters
-
- Returns
- This builder for chaining.
Definition at line 806 of file MPSosConstraint.java.
◆ setUnknownFields()
| .lang.Override final Builder setUnknownFields |
( |
final com.google.protobuf.UnknownFieldSet |
unknownFields | ) |
|
|
inline |
◆ setVarIndex()
| Builder setVarIndex |
( |
int |
index, |
|
|
int |
value |
|
) |
| |
|
inline |
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.
Definition at line 883 of file MPSosConstraint.java.
◆ setWeight()
| Builder setWeight |
( |
int |
index, |
|
|
double |
value |
|
) |
| |
|
inline |
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.
Definition at line 1029 of file MPSosConstraint.java.
The documentation for this class was generated from the following file: