Java Reference

Java Reference

MPSosConstraint

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

Classes

class  Builder
 
enum  Type
 Protobuf enum. More...
 

Public Member Functions

.lang.Override final com.google.protobuf.UnknownFieldSet getUnknownFields ()
 
.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...
 
.lang.Override java.util.List< java.lang.Integer > getVarIndexList ()
 
int getVarIndexCount ()
 
int getVarIndex (int index)
 
.lang.Override java.util.List< java.lang.Double > getWeightList ()
 
int getWeightCount ()
 
double getWeight (int index)
 
.lang.Override final boolean isInitialized ()
 
.lang.Override void writeTo (com.google.protobuf.CodedOutputStream output) throws java.io.IOException
 
.lang.Override int getSerializedSize ()
 
.lang.Override boolean equals (final java.lang.Object obj)
 
.lang.Override int hashCode ()
 
.lang.Override Builder newBuilderForType ()
 
.lang.Override Builder toBuilder ()
 
.lang.Override com.google.protobuf.Parser< MPSosConstraintgetParserForType ()
 
.lang.Override 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
 
.lang.Deprecated static final com.google.protobuf.Parser< MPSosConstraintPARSER
 

Protected Member Functions

.lang.Override java.lang.Object newInstance (UnusedPrivateParameter unused)
 
.lang.Override com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable ()
 
.lang.Override Builder newBuilderForType (com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
 

Member Function Documentation

◆ equals()

.lang.Override boolean equals ( final java.lang.Object  obj)
inline

Definition at line 454 of file MPSosConstraint.java.

◆ getDefaultInstance()

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

Definition at line 1131 of file MPSosConstraint.java.

◆ getDefaultInstanceForType()

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

Definition at line 1156 of file MPSosConstraint.java.

◆ getDescriptor()

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

Definition at line 141 of file MPSosConstraint.java.

◆ getParserForType()

.lang.Override com.google.protobuf.Parser<MPSosConstraint> getParserForType ( )
inline

Definition at line 1151 of file MPSosConstraint.java.

◆ getSerializedSize()

.lang.Override int getSerializedSize ( )
inline

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

◆ getUnknownFields()

.lang.Override final com.google.protobuf.UnknownFieldSet getUnknownFields ( )
inline

Definition at line 39 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 327 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 314 of file MPSosConstraint.java.

◆ getVarIndexList()

.lang.Override 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 302 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 393 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 372 of file MPSosConstraint.java.

◆ getWeightList()

.lang.Override 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 352 of file MPSosConstraint.java.

◆ hashCode()

.lang.Override int hashCode ( )
inline

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

◆ internalGetFieldAccessorTable()

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

Definition at line 147 of file MPSosConstraint.java.

◆ isInitialized()

.lang.Override final boolean isInitialized ( )
inline

Definition at line 399 of file MPSosConstraint.java.

◆ newBuilder() [1/2]

static Builder newBuilder ( )
inlinestatic

Definition at line 571 of file MPSosConstraint.java.

◆ newBuilder() [2/2]

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

Definition at line 574 of file MPSosConstraint.java.

◆ newBuilderForType() [1/2]

.lang.Override Builder newBuilderForType ( )
inline

Definition at line 570 of file MPSosConstraint.java.

◆ newBuilderForType() [2/2]

.lang.Override Builder newBuilderForType ( com.google.protobuf.GeneratedMessageV3.BuilderParent  parent)
inlineprotected

Definition at line 584 of file MPSosConstraint.java.

◆ newInstance()

.lang.Override java.lang.Object newInstance ( UnusedPrivateParameter  unused)
inlineprotected

Definition at line 32 of file MPSosConstraint.java.

◆ parseDelimitedFrom() [1/2]

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

Definition at line 543 of file MPSosConstraint.java.

◆ parseDelimitedFrom() [2/2]

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

Definition at line 548 of file MPSosConstraint.java.

◆ parseFrom() [1/10]

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

Definition at line 521 of file MPSosConstraint.java.

◆ parseFrom() [2/10]

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

Definition at line 525 of file MPSosConstraint.java.

◆ parseFrom() [3/10]

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

Definition at line 510 of file MPSosConstraint.java.

◆ parseFrom() [4/10]

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

Definition at line 515 of file MPSosConstraint.java.

◆ parseFrom() [5/10]

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

Definition at line 555 of file MPSosConstraint.java.

◆ parseFrom() [6/10]

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

Definition at line 561 of file MPSosConstraint.java.

◆ parseFrom() [7/10]

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

Definition at line 531 of file MPSosConstraint.java.

◆ parseFrom() [8/10]

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

Definition at line 536 of file MPSosConstraint.java.

◆ parseFrom() [9/10]

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

Definition at line 499 of file MPSosConstraint.java.

◆ parseFrom() [10/10]

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

Definition at line 504 of file MPSosConstraint.java.

◆ parser()

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

Definition at line 1146 of file MPSosConstraint.java.

◆ toBuilder()

.lang.Override Builder toBuilder ( )
inline

Definition at line 578 of file MPSosConstraint.java.

◆ writeTo()

.lang.Override void writeTo ( com.google.protobuf.CodedOutputStream  output) throws java.io.IOException
inline

Definition at line 409 of file MPSosConstraint.java.

Member Data Documentation

◆ PARSER

.lang.Deprecated static final com.google.protobuf.Parser<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 {
return new MPSosConstraint(input, extensionRegistry);
}
}

Definition at line 1136 of file MPSosConstraint.java.

◆ TYPE_FIELD_NUMBER

final int TYPE_FIELD_NUMBER = 1
static

Definition at line 270 of file MPSosConstraint.java.

◆ VAR_INDEX_FIELD_NUMBER

final int VAR_INDEX_FIELD_NUMBER = 2
static

Definition at line 289 of file MPSosConstraint.java.

◆ WEIGHT_FIELD_NUMBER

final int WEIGHT_FIELD_NUMBER = 3
static

Definition at line 331 of file MPSosConstraint.java.


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