Google OR-Tools v9.11
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 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 ()
 
- Public Member Functions inherited from com.google.ortools.linearsolver.MPSosConstraintOrBuilder

Static Public Member Functions

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

Protected Member Functions

com.google.protobuf.GeneratedMessage.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 512 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 856 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 1029 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 838 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 1003 of file MPSosConstraint.java.

◆ build()

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

Definition at line 561 of file MPSosConstraint.java.

◆ buildPartial()

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

Definition at line 570 of file MPSosConstraint.java.

◆ clear()

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

Definition at line 540 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 755 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 874 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 1055 of file MPSosConstraint.java.

◆ getDefaultInstanceForType()

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

Definition at line 556 of file MPSosConstraint.java.

◆ getDescriptor()

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

Definition at line 517 of file MPSosConstraint.java.

◆ getDescriptorForType()

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

Definition at line 551 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 733 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 805 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 792 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 779 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 954 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 933 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 912 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 725 of file MPSosConstraint.java.

◆ internalGetFieldAccessorTable()

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

Definition at line 523 of file MPSosConstraint.java.

◆ isInitialized()

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

Definition at line 638 of file MPSosConstraint.java.

◆ mergeFrom() [1/3]

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

Definition at line 605 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 643 of file MPSosConstraint.java.

◆ mergeFrom() [3/3]

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

Definition at line 596 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 742 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 819 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 976 of file MPSosConstraint.java.


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