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

Classes

class  Builder
 
enum  Type
 

Public Member Functions

boolean hasType ()
 
com.google.ortools.linearsolver.MPSosConstraint.Type getType ()
 
java.util.List< java.lang.Integer > getVarIndexList ()
 
int getVarIndexCount ()
 
int getVarIndex (int index)
 
java.util.List< java.lang.Double > getWeightList ()
 
int getWeightCount ()
 
double getWeight (int index)
 
final boolean isInitialized ()
 
void writeTo (com.google.protobuf.CodedOutputStream output) throws java.io.IOException
 
int getSerializedSize ()
 
boolean equals (final java.lang.Object obj)
 
int hashCode ()
 
Builder newBuilderForType ()
 
Builder toBuilder ()
 
com.google.protobuf.Parser< MPSosConstraintgetParserForType ()
 
com.google.ortools.linearsolver.MPSosConstraint getDefaultInstanceForType ()
 
- Public Member Functions inherited from com.google.ortools.linearsolver.MPSosConstraintOrBuilder

Static Public Member Functions

static final com.google.protobuf.Descriptors.Descriptor getDescriptor ()
 
static com.google.ortools.linearsolver.MPSosConstraint parseFrom (java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
 
static com.google.ortools.linearsolver.MPSosConstraint parseFrom (java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
 
static com.google.ortools.linearsolver.MPSosConstraint parseFrom (com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
 
static com.google.ortools.linearsolver.MPSosConstraint parseFrom (com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
 
static com.google.ortools.linearsolver.MPSosConstraint parseFrom (byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
 
static com.google.ortools.linearsolver.MPSosConstraint parseFrom (byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
 
static com.google.ortools.linearsolver.MPSosConstraint parseFrom (java.io.InputStream input) throws java.io.IOException
 
static com.google.ortools.linearsolver.MPSosConstraint parseFrom (java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
 
static com.google.ortools.linearsolver.MPSosConstraint parseDelimitedFrom (java.io.InputStream input) throws java.io.IOException
 
static com.google.ortools.linearsolver.MPSosConstraint parseDelimitedFrom (java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
 
static com.google.ortools.linearsolver.MPSosConstraint parseFrom (com.google.protobuf.CodedInputStream input) throws java.io.IOException
 
static com.google.ortools.linearsolver.MPSosConstraint parseFrom (com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
 
static Builder newBuilder ()
 
static Builder newBuilder (com.google.ortools.linearsolver.MPSosConstraint prototype)
 
static com.google.ortools.linearsolver.MPSosConstraint getDefaultInstance ()
 
static com.google.protobuf.Parser< MPSosConstraintparser ()
 

Static Public Attributes

static final int TYPE_FIELD_NUMBER = 1
 
static final int VAR_INDEX_FIELD_NUMBER = 2
 
static final int WEIGHT_FIELD_NUMBER = 3
 

Protected Member Functions

com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable ()
 
Builder newBuilderForType (com.google.protobuf.GeneratedMessage.BuilderParent parent)
 

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

Member Function Documentation

◆ equals()

boolean com.google.ortools.linearsolver.MPSosConstraint.equals ( final java.lang.Object obj)

Definition at line 366 of file MPSosConstraint.java.

◆ getDefaultInstance()

static com.google.ortools.linearsolver.MPSosConstraint com.google.ortools.linearsolver.MPSosConstraint.getDefaultInstance ( )
static

Definition at line 1071 of file MPSosConstraint.java.

◆ getDefaultInstanceForType()

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

Definition at line 1107 of file MPSosConstraint.java.

◆ getDescriptor()

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

Definition at line 41 of file MPSosConstraint.java.

◆ getParserForType()

com.google.protobuf.Parser< MPSosConstraint > com.google.ortools.linearsolver.MPSosConstraint.getParserForType ( )

Definition at line 1102 of file MPSosConstraint.java.

◆ getSerializedSize()

int com.google.ortools.linearsolver.MPSosConstraint.getSerializedSize ( )

Definition at line 336 of file MPSosConstraint.java.

◆ getType()

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

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

Returns
The type.

Implements com.google.ortools.linearsolver.MPSosConstraintOrBuilder.

Definition at line 192 of file MPSosConstraint.java.

◆ getVarIndex()

int com.google.ortools.linearsolver.MPSosConstraint.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 237 of file MPSosConstraint.java.

◆ getVarIndexCount()

int com.google.ortools.linearsolver.MPSosConstraint.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 224 of file MPSosConstraint.java.

◆ getVarIndexList()

java.util.List< java.lang.Integer > com.google.ortools.linearsolver.MPSosConstraint.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 212 of file MPSosConstraint.java.

◆ getWeight()

double com.google.ortools.linearsolver.MPSosConstraint.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 305 of file MPSosConstraint.java.

◆ getWeightCount()

int com.google.ortools.linearsolver.MPSosConstraint.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 284 of file MPSosConstraint.java.

◆ getWeightList()

java.util.List< java.lang.Double > com.google.ortools.linearsolver.MPSosConstraint.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 264 of file MPSosConstraint.java.

◆ hashCode()

int com.google.ortools.linearsolver.MPSosConstraint.hashCode ( )

Definition at line 388 of file MPSosConstraint.java.

◆ hasType()

boolean com.google.ortools.linearsolver.MPSosConstraint.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 185 of file MPSosConstraint.java.

◆ internalGetFieldAccessorTable()

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

Definition at line 47 of file MPSosConstraint.java.

◆ isInitialized()

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

Definition at line 311 of file MPSosConstraint.java.

◆ newBuilder() [1/2]

static Builder com.google.ortools.linearsolver.MPSosConstraint.newBuilder ( )
static

Definition at line 485 of file MPSosConstraint.java.

◆ newBuilder() [2/2]

static Builder com.google.ortools.linearsolver.MPSosConstraint.newBuilder ( com.google.ortools.linearsolver.MPSosConstraint prototype)
static

Definition at line 488 of file MPSosConstraint.java.

◆ newBuilderForType() [1/2]

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

Definition at line 484 of file MPSosConstraint.java.

◆ newBuilderForType() [2/2]

Builder com.google.ortools.linearsolver.MPSosConstraint.newBuilderForType ( com.google.protobuf.GeneratedMessage.BuilderParent parent)
protected

Definition at line 498 of file MPSosConstraint.java.

◆ parseDelimitedFrom() [1/2]

static com.google.ortools.linearsolver.MPSosConstraint com.google.ortools.linearsolver.MPSosConstraint.parseDelimitedFrom ( java.io.InputStream input) throws java.io.IOException
static

Definition at line 456 of file MPSosConstraint.java.

◆ parseDelimitedFrom() [2/2]

static com.google.ortools.linearsolver.MPSosConstraint com.google.ortools.linearsolver.MPSosConstraint.parseDelimitedFrom ( java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry ) throws java.io.IOException
static

Definition at line 462 of file MPSosConstraint.java.

◆ parseFrom() [1/10]

static com.google.ortools.linearsolver.MPSosConstraint com.google.ortools.linearsolver.MPSosConstraint.parseFrom ( byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
static

Definition at line 433 of file MPSosConstraint.java.

◆ parseFrom() [2/10]

static com.google.ortools.linearsolver.MPSosConstraint com.google.ortools.linearsolver.MPSosConstraint.parseFrom ( byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry ) throws com.google.protobuf.InvalidProtocolBufferException
static

Definition at line 437 of file MPSosConstraint.java.

◆ parseFrom() [3/10]

static com.google.ortools.linearsolver.MPSosConstraint com.google.ortools.linearsolver.MPSosConstraint.parseFrom ( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
static

Definition at line 422 of file MPSosConstraint.java.

◆ parseFrom() [4/10]

static com.google.ortools.linearsolver.MPSosConstraint com.google.ortools.linearsolver.MPSosConstraint.parseFrom ( com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry ) throws com.google.protobuf.InvalidProtocolBufferException
static

Definition at line 427 of file MPSosConstraint.java.

◆ parseFrom() [5/10]

static com.google.ortools.linearsolver.MPSosConstraint com.google.ortools.linearsolver.MPSosConstraint.parseFrom ( com.google.protobuf.CodedInputStream input) throws java.io.IOException
static

Definition at line 469 of file MPSosConstraint.java.

◆ parseFrom() [6/10]

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

Definition at line 475 of file MPSosConstraint.java.

◆ parseFrom() [7/10]

static com.google.ortools.linearsolver.MPSosConstraint com.google.ortools.linearsolver.MPSosConstraint.parseFrom ( java.io.InputStream input) throws java.io.IOException
static

Definition at line 443 of file MPSosConstraint.java.

◆ parseFrom() [8/10]

static com.google.ortools.linearsolver.MPSosConstraint com.google.ortools.linearsolver.MPSosConstraint.parseFrom ( java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry ) throws java.io.IOException
static

Definition at line 448 of file MPSosConstraint.java.

◆ parseFrom() [9/10]

static com.google.ortools.linearsolver.MPSosConstraint com.google.ortools.linearsolver.MPSosConstraint.parseFrom ( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
static

Definition at line 411 of file MPSosConstraint.java.

◆ parseFrom() [10/10]

static com.google.ortools.linearsolver.MPSosConstraint com.google.ortools.linearsolver.MPSosConstraint.parseFrom ( java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry ) throws com.google.protobuf.InvalidProtocolBufferException
static

Definition at line 416 of file MPSosConstraint.java.

◆ parser()

static com.google.protobuf.Parser< MPSosConstraint > com.google.ortools.linearsolver.MPSosConstraint.parser ( )
static

Definition at line 1097 of file MPSosConstraint.java.

◆ toBuilder()

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

Definition at line 492 of file MPSosConstraint.java.

◆ writeTo()

void com.google.ortools.linearsolver.MPSosConstraint.writeTo ( com.google.protobuf.CodedOutputStream output) throws java.io.IOException

Definition at line 321 of file MPSosConstraint.java.

Member Data Documentation

◆ TYPE_FIELD_NUMBER

final int com.google.ortools.linearsolver.MPSosConstraint.TYPE_FIELD_NUMBER = 1
static

Definition at line 179 of file MPSosConstraint.java.

◆ VAR_INDEX_FIELD_NUMBER

final int com.google.ortools.linearsolver.MPSosConstraint.VAR_INDEX_FIELD_NUMBER = 2
static

Definition at line 197 of file MPSosConstraint.java.

◆ WEIGHT_FIELD_NUMBER

final int com.google.ortools.linearsolver.MPSosConstraint.WEIGHT_FIELD_NUMBER = 3
static

Definition at line 241 of file MPSosConstraint.java.


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