Google OR-Tools v9.9
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
com.google.ortools.linearsolver.MPSosConstraint.Builder Class Reference
Inheritance diagram for com.google.ortools.linearsolver.MPSosConstraint.Builder:
com.google.ortools.linearsolver.MPSosConstraintOrBuilder

Public Member Functions

Builder clear ()
 
com.google.protobuf.Descriptors.Descriptor getDescriptorForType ()
 
com.google.ortools.linearsolver.MPSosConstraint getDefaultInstanceForType ()
 
com.google.ortools.linearsolver.MPSosConstraint build ()
 
com.google.ortools.linearsolver.MPSosConstraint buildPartial ()
 
Builder clone ()
 
Builder setField (com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)
 
Builder clearField (com.google.protobuf.Descriptors.FieldDescriptor field)
 
Builder clearOneof (com.google.protobuf.Descriptors.OneofDescriptor oneof)
 
Builder setRepeatedField (com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)
 
Builder addRepeatedField (com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)
 
Builder mergeFrom (com.google.protobuf.Message other)
 
Builder mergeFrom (com.google.ortools.linearsolver.MPSosConstraint other)
 
final boolean isInitialized ()
 
Builder mergeFrom (com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
 
boolean hasType ()
 
com.google.ortools.linearsolver.MPSosConstraint.Type getType ()
 
Builder setType (com.google.ortools.linearsolver.MPSosConstraint.Type value)
 
Builder clearType ()
 
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 ()
 
final Builder setUnknownFields (final com.google.protobuf.UnknownFieldSet unknownFields)
 
final Builder mergeUnknownFields (final com.google.protobuf.UnknownFieldSet unknownFields)
 

Static Public Member Functions

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

Protected Member Functions

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

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 501 of file MPSosConstraint.java.

Member Function Documentation

◆ addAllVarIndex()

Builder com.google.ortools.linearsolver.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
valuesThe varIndex to add.
Returns
This builder for chaining.

Definition at line 877 of file MPSosConstraint.java.

◆ addAllWeight()

Builder com.google.ortools.linearsolver.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
valuesThe weight to add.
Returns
This builder for chaining.

Definition at line 1050 of file MPSosConstraint.java.

◆ addRepeatedField()

Builder com.google.ortools.linearsolver.MPSosConstraint.Builder.addRepeatedField ( com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value )

Definition at line 611 of file MPSosConstraint.java.

◆ addVarIndex()

Builder com.google.ortools.linearsolver.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
valueThe varIndex to add.
Returns
This builder for chaining.

Definition at line 859 of file MPSosConstraint.java.

◆ addWeight()

Builder com.google.ortools.linearsolver.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
valueThe weight to add.
Returns
This builder for chaining.

Definition at line 1024 of file MPSosConstraint.java.

◆ build()

com.google.ortools.linearsolver.MPSosConstraint com.google.ortools.linearsolver.MPSosConstraint.Builder.build ( )

Definition at line 550 of file MPSosConstraint.java.

◆ buildPartial()

com.google.ortools.linearsolver.MPSosConstraint com.google.ortools.linearsolver.MPSosConstraint.Builder.buildPartial ( )

Definition at line 559 of file MPSosConstraint.java.

◆ clear()

Builder com.google.ortools.linearsolver.MPSosConstraint.Builder.clear ( )

Definition at line 529 of file MPSosConstraint.java.

◆ clearField()

Builder com.google.ortools.linearsolver.MPSosConstraint.Builder.clearField ( com.google.protobuf.Descriptors.FieldDescriptor field)

Definition at line 595 of file MPSosConstraint.java.

◆ clearOneof()

Builder com.google.ortools.linearsolver.MPSosConstraint.Builder.clearOneof ( com.google.protobuf.Descriptors.OneofDescriptor oneof)

Definition at line 600 of file MPSosConstraint.java.

◆ clearType()

Builder com.google.ortools.linearsolver.MPSosConstraint.Builder.clearType ( )

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

Returns
This builder for chaining.

Definition at line 776 of file MPSosConstraint.java.

◆ clearVarIndex()

Builder com.google.ortools.linearsolver.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.

Definition at line 895 of file MPSosConstraint.java.

◆ clearWeight()

Builder com.google.ortools.linearsolver.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.

Definition at line 1076 of file MPSosConstraint.java.

◆ clone()

Builder com.google.ortools.linearsolver.MPSosConstraint.Builder.clone ( )

Definition at line 585 of file MPSosConstraint.java.

◆ getDefaultInstanceForType()

com.google.ortools.linearsolver.MPSosConstraint com.google.ortools.linearsolver.MPSosConstraint.Builder.getDefaultInstanceForType ( )

Definition at line 545 of file MPSosConstraint.java.

◆ getDescriptor()

static final com.google.protobuf.Descriptors.Descriptor com.google.ortools.linearsolver.MPSosConstraint.Builder.getDescriptor ( )
static

Definition at line 506 of file MPSosConstraint.java.

◆ getDescriptorForType()

com.google.protobuf.Descriptors.Descriptor com.google.ortools.linearsolver.MPSosConstraint.Builder.getDescriptorForType ( )

Definition at line 540 of file MPSosConstraint.java.

◆ getType()

com.google.ortools.linearsolver.MPSosConstraint.Type com.google.ortools.linearsolver.MPSosConstraint.Builder.getType ( )

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

Returns
The type.

Implements com.google.ortools.linearsolver.MPSosConstraintOrBuilder.

Definition at line 754 of file MPSosConstraint.java.

◆ getVarIndex()

int com.google.ortools.linearsolver.MPSosConstraint.Builder.getVarIndex ( int index)
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 com.google.ortools.linearsolver.MPSosConstraintOrBuilder.

Definition at line 826 of file MPSosConstraint.java.

◆ getVarIndexCount()

int com.google.ortools.linearsolver.MPSosConstraint.Builder.getVarIndexCount ( )
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 com.google.ortools.linearsolver.MPSosConstraintOrBuilder.

Definition at line 813 of file MPSosConstraint.java.

◆ getVarIndexList()

java.util.List< java.lang.Integer > com.google.ortools.linearsolver.MPSosConstraint.Builder.getVarIndexList ( )
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 com.google.ortools.linearsolver.MPSosConstraintOrBuilder.

Definition at line 800 of file MPSosConstraint.java.

◆ getWeight()

double com.google.ortools.linearsolver.MPSosConstraint.Builder.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;

Parameters
indexThe index of the element to return.
Returns
The weight at the given index.

Implements com.google.ortools.linearsolver.MPSosConstraintOrBuilder.

Definition at line 975 of file MPSosConstraint.java.

◆ getWeightCount()

int com.google.ortools.linearsolver.MPSosConstraint.Builder.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 com.google.ortools.linearsolver.MPSosConstraintOrBuilder.

Definition at line 954 of file MPSosConstraint.java.

◆ getWeightList()

java.util.List< java.lang.Double > com.google.ortools.linearsolver.MPSosConstraint.Builder.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;

Returns
A list containing the weight.

Implements com.google.ortools.linearsolver.MPSosConstraintOrBuilder.

Definition at line 933 of file MPSosConstraint.java.

◆ hasType()

boolean com.google.ortools.linearsolver.MPSosConstraint.Builder.hasType ( )

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

Returns
Whether the type field is set.

Implements com.google.ortools.linearsolver.MPSosConstraintOrBuilder.

Definition at line 746 of file MPSosConstraint.java.

◆ internalGetFieldAccessorTable()

com.google.protobuf.GeneratedMessageV3.FieldAccessorTable com.google.ortools.linearsolver.MPSosConstraint.Builder.internalGetFieldAccessorTable ( )
protected

Definition at line 512 of file MPSosConstraint.java.

◆ isInitialized()

final boolean com.google.ortools.linearsolver.MPSosConstraint.Builder.isInitialized ( )

Definition at line 659 of file MPSosConstraint.java.

◆ mergeFrom() [1/3]

Builder com.google.ortools.linearsolver.MPSosConstraint.Builder.mergeFrom ( com.google.ortools.linearsolver.MPSosConstraint other)

Definition at line 626 of file MPSosConstraint.java.

◆ mergeFrom() [2/3]

Builder com.google.ortools.linearsolver.MPSosConstraint.Builder.mergeFrom ( com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry ) throws java.io.IOException

Definition at line 664 of file MPSosConstraint.java.

◆ mergeFrom() [3/3]

Builder com.google.ortools.linearsolver.MPSosConstraint.Builder.mergeFrom ( com.google.protobuf.Message other)

Definition at line 617 of file MPSosConstraint.java.

◆ mergeUnknownFields()

final Builder com.google.ortools.linearsolver.MPSosConstraint.Builder.mergeUnknownFields ( final com.google.protobuf.UnknownFieldSet unknownFields)

Definition at line 1089 of file MPSosConstraint.java.

◆ setField()

Builder com.google.ortools.linearsolver.MPSosConstraint.Builder.setField ( com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value )

Definition at line 589 of file MPSosConstraint.java.

◆ setRepeatedField()

Builder com.google.ortools.linearsolver.MPSosConstraint.Builder.setRepeatedField ( com.google.protobuf.Descriptors.FieldDescriptor field,
int index,
java.lang.Object value )

Definition at line 605 of file MPSosConstraint.java.

◆ setType()

Builder com.google.ortools.linearsolver.MPSosConstraint.Builder.setType ( com.google.ortools.linearsolver.MPSosConstraint.Type value)

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

Parameters
valueThe type to set.
Returns
This builder for chaining.

Definition at line 763 of file MPSosConstraint.java.

◆ setUnknownFields()

final Builder com.google.ortools.linearsolver.MPSosConstraint.Builder.setUnknownFields ( final com.google.protobuf.UnknownFieldSet unknownFields)

Definition at line 1083 of file MPSosConstraint.java.

◆ setVarIndex()

Builder com.google.ortools.linearsolver.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
indexThe index to set the value at.
valueThe varIndex to set.
Returns
This builder for chaining.

Definition at line 840 of file MPSosConstraint.java.

◆ setWeight()

Builder com.google.ortools.linearsolver.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
indexThe index to set the value at.
valueThe weight to set.
Returns
This builder for chaining.

Definition at line 997 of file MPSosConstraint.java.


The documentation for this class was generated from the following file: