Java Reference

Java Reference

MPSosConstraint.Builder

Detailed Description

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.

Public Member Functions

.lang.Override Builder clear ()
 
.lang.Override com.google.protobuf.Descriptors.Descriptor getDescriptorForType ()
 
.lang.Override com.google.ortools.linearsolver.MPSosConstraint getDefaultInstanceForType ()
 
.lang.Override com.google.ortools.linearsolver.MPSosConstraint build ()
 
.lang.Override com.google.ortools.linearsolver.MPSosConstraint buildPartial ()
 
.lang.Override Builder clone ()
 
.lang.Override Builder setField (com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)
 
.lang.Override Builder clearField (com.google.protobuf.Descriptors.FieldDescriptor field)
 
.lang.Override Builder clearOneof (com.google.protobuf.Descriptors.OneofDescriptor oneof)
 
.lang.Override Builder setRepeatedField (com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)
 
.lang.Override Builder addRepeatedField (com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)
 
.lang.Override Builder mergeFrom (com.google.protobuf.Message other)
 
Builder mergeFrom (com.google.ortools.linearsolver.MPSosConstraint other)
 
.lang.Override final boolean isInitialized ()
 
.lang.Override Builder mergeFrom (com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
 
.lang.Override boolean hasType ()
 optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT]; More...
 
.lang.Override com.google.ortools.linearsolver.MPSosConstraint.Type getType ()
 optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT]; More...
 
Builder setType (com.google.ortools.linearsolver.MPSosConstraint.Type value)
 optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT]; More...
 
Builder clearType ()
 optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT]; More...
 
java.util.List< java.lang.Integer > getVarIndexList ()
 
int getVarIndexCount ()
 
int getVarIndex (int index)
 
Builder setVarIndex (int index, int value)
 
Builder addVarIndex (int value)
 
Builder addAllVarIndex (java.lang.Iterable<? extends java.lang.Integer > values)
 
Builder clearVarIndex ()
 
java.util.List< java.lang.Double > getWeightList ()
 
int getWeightCount ()
 
double getWeight (int index)
 
Builder setWeight (int index, double value)
 
Builder addWeight (double value)
 
Builder addAllWeight (java.lang.Iterable<? extends java.lang.Double > values)
 
Builder clearWeight ()
 
.lang.Override final Builder setUnknownFields (final com.google.protobuf.UnknownFieldSet unknownFields)
 
.lang.Override final Builder mergeUnknownFields (final com.google.protobuf.UnknownFieldSet unknownFields)
 

Static Public Member Functions

static final com.google.protobuf.Descriptors.Descriptor getDescriptor ()
 

Protected Member Functions

.lang.Override com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable ()
 

Member Function Documentation

◆ 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
valuesThe 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
valuesThe weight to add.
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

Definition at line 713 of file MPSosConstraint.java.

◆ addVarIndex()

Builder addVarIndex ( 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
valueThe varIndex to add.
Returns
This builder for chaining.

Definition at line 900 of file MPSosConstraint.java.

◆ addWeight()

Builder addWeight ( 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
valueThe weight to add.
Returns
This builder for chaining.

Definition at line 1054 of file MPSosConstraint.java.

◆ build()

.lang.Override com.google.ortools.linearsolver.MPSosConstraint build ( )
inline

Definition at line 654 of file MPSosConstraint.java.

◆ buildPartial()

.lang.Override com.google.ortools.linearsolver.MPSosConstraint buildPartial ( )
inline

Definition at line 663 of file MPSosConstraint.java.

◆ clear()

.lang.Override Builder clear ( )
inline

Definition at line 631 of file MPSosConstraint.java.

◆ clearField()

.lang.Override Builder clearField ( com.google.protobuf.Descriptors.FieldDescriptor  field)
inline

Definition at line 697 of file MPSosConstraint.java.

◆ clearOneof()

.lang.Override Builder clearOneof ( com.google.protobuf.Descriptors.OneofDescriptor  oneof)
inline

Definition at line 702 of file MPSosConstraint.java.

◆ clearType()

Builder clearType ( )
inline

optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT];

Returns
This builder for chaining.

Definition at line 819 of file MPSosConstraint.java.

◆ clearVarIndex()

Builder clearVarIndex ( )
inline
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()

Builder clearWeight ( )
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
This builder for chaining.

Definition at line 1103 of file MPSosConstraint.java.

◆ clone()

.lang.Override Builder clone ( )
inline

Definition at line 687 of file MPSosConstraint.java.

◆ getDefaultInstanceForType()

.lang.Override com.google.ortools.linearsolver.MPSosConstraint getDefaultInstanceForType ( )
inline

Definition at line 649 of file MPSosConstraint.java.

◆ getDescriptor()

static final com.google.protobuf.Descriptors.Descriptor getDescriptor ( )
inlinestatic

Definition at line 603 of file MPSosConstraint.java.

◆ getDescriptorForType()

.lang.Override com.google.protobuf.Descriptors.Descriptor getDescriptorForType ( )
inline

Definition at line 644 of file MPSosConstraint.java.

◆ getType()

.lang.Override com.google.ortools.linearsolver.MPSosConstraint.Type getType ( )
inline

optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT];

Returns
The type.

Implements MPSosConstraintOrBuilder.

Definition at line 796 of file MPSosConstraint.java.

◆ 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
indexThe index of the element to return.
Returns
The varIndex at the given index.

Implements MPSosConstraintOrBuilder.

Definition at line 869 of file MPSosConstraint.java.

◆ getVarIndexCount()

int getVarIndexCount ( )
inline
Variable index (w.r.t. the "variable" field of MPModelProto) of the
variables in the SOS.

repeated int32 var_index = 2;

Returns
The count of varIndex.

Implements MPSosConstraintOrBuilder.

Definition at line 856 of file MPSosConstraint.java.

◆ getVarIndexList()

java.util.List<java.lang.Integer> getVarIndexList ( )
inline
Variable index (w.r.t. the "variable" field of MPModelProto) of the
variables in the SOS.

repeated int32 var_index = 2;

Returns
A list containing the varIndex.

Implements MPSosConstraintOrBuilder.

Definition at line 843 of file MPSosConstraint.java.

◆ 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
indexThe index of the element to return.
Returns
The weight at the given index.

Implements MPSosConstraintOrBuilder.

Definition at line 1007 of file MPSosConstraint.java.

◆ getWeightCount()

int getWeightCount ( )
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
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

optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT];

Returns
Whether the type field is set.

Implements MPSosConstraintOrBuilder.

Definition at line 788 of file MPSosConstraint.java.

◆ internalGetFieldAccessorTable()

.lang.Override com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable ( )
inlineprotected

Definition at line 609 of file MPSosConstraint.java.

◆ isInitialized()

.lang.Override final boolean isInitialized ( )
inline

Definition at line 759 of file MPSosConstraint.java.

◆ mergeFrom() [1/3]

Definition at line 728 of file MPSosConstraint.java.

◆ mergeFrom() [2/3]

.lang.Override Builder mergeFrom ( com.google.protobuf.CodedInputStream  input,
com.google.protobuf.ExtensionRegistryLite  extensionRegistry 
) throws java.io.IOException
inline

Definition at line 764 of file MPSosConstraint.java.

◆ mergeFrom() [3/3]

.lang.Override Builder mergeFrom ( com.google.protobuf.Message  other)
inline

Definition at line 719 of file MPSosConstraint.java.

◆ mergeUnknownFields()

.lang.Override final Builder mergeUnknownFields ( final com.google.protobuf.UnknownFieldSet  unknownFields)
inline

Definition at line 1116 of file MPSosConstraint.java.

◆ setField()

.lang.Override Builder setField ( com.google.protobuf.Descriptors.FieldDescriptor  field,
java.lang.Object  value 
)
inline

Definition at line 691 of file MPSosConstraint.java.

◆ setRepeatedField()

.lang.Override Builder setRepeatedField ( com.google.protobuf.Descriptors.FieldDescriptor  field,
int  index,
java.lang.Object  value 
)
inline

Definition at line 707 of file MPSosConstraint.java.

◆ setType()

optional .operations_research.MPSosConstraint.Type type = 1 [default = SOS1_DEFAULT];

Parameters
valueThe type to set.
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

Definition at line 1110 of file MPSosConstraint.java.

◆ 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
indexThe index to set the value at.
valueThe 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
indexThe index to set the value at.
valueThe 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: