Google OR-Tools v9.9
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 ()
 

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
 
static final com.google.protobuf.Parser< MPSosConstraintPARSER
 

Protected Member Functions

java.lang.Object newInstance (UnusedPrivateParameter unused)
 
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable ()
 
Builder newBuilderForType (com.google.protobuf.GeneratedMessageV3.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 355 of file MPSosConstraint.java.

◆ getDefaultInstance()

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

Definition at line 1104 of file MPSosConstraint.java.

◆ getDefaultInstanceForType()

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

Definition at line 1140 of file MPSosConstraint.java.

◆ getDescriptor()

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

Definition at line 39 of file MPSosConstraint.java.

◆ getParserForType()

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

Definition at line 1135 of file MPSosConstraint.java.

◆ getSerializedSize()

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

Definition at line 325 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 181 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 226 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 213 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 201 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 294 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 273 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 253 of file MPSosConstraint.java.

◆ hashCode()

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

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

◆ internalGetFieldAccessorTable()

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

Definition at line 45 of file MPSosConstraint.java.

◆ isInitialized()

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

Definition at line 300 of file MPSosConstraint.java.

◆ newBuilder() [1/2]

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

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

◆ newBuilderForType() [1/2]

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

Definition at line 473 of file MPSosConstraint.java.

◆ newBuilderForType() [2/2]

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

Definition at line 487 of file MPSosConstraint.java.

◆ newInstance()

java.lang.Object com.google.ortools.linearsolver.MPSosConstraint.newInstance ( UnusedPrivateParameter unused)
protected

Definition at line 33 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 445 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 451 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 422 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 426 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 411 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 416 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 458 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 464 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 432 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 437 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 400 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 405 of file MPSosConstraint.java.

◆ parser()

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

Definition at line 1130 of file MPSosConstraint.java.

◆ toBuilder()

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

Definition at line 481 of file MPSosConstraint.java.

◆ writeTo()

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

Definition at line 310 of file MPSosConstraint.java.

Member Data Documentation

◆ PARSER

final com.google.protobuf.Parser<MPSosConstraint> com.google.ortools.linearsolver.MPSosConstraint.PARSER
static
Initial value:
= new com.google.protobuf.AbstractParser<MPSosConstraint>() {
@java.lang.Override
public MPSosConstraint parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
Builder builder = newBuilder();
try {
builder.mergeFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(builder.buildPartial());
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e)
.setUnfinishedMessage(builder.buildPartial());
}
return builder.buildPartial();
}
}

Definition at line 1109 of file MPSosConstraint.java.

◆ TYPE_FIELD_NUMBER

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

Definition at line 168 of file MPSosConstraint.java.

◆ VAR_INDEX_FIELD_NUMBER

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

Definition at line 186 of file MPSosConstraint.java.

◆ WEIGHT_FIELD_NUMBER

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

Definition at line 230 of file MPSosConstraint.java.


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