com.google.ortools.linearsolver.MPConstraintProto Maven / Gradle / Ivy
The newest version!
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: ortools/linear_solver/linear_solver.proto
package com.google.ortools.linearsolver;
/**
*
* A linear constraint is always of the form:
* lower_bound <= sum of linear term elements <= upper_bound,
* where lower_bound and upper_bound:
* - Can form a singleton: lower_bound == upper_bound. The constraint is an
* equation.
* - Can form a finite interval [lower_bound, upper_bound]. The constraint is
* both lower- and upper-bounded, i.e. "boxed".
* - Can form a semi-infinite interval. lower_bound = -infinity: the constraint
* is upper-bounded. upper_bound = +infinity: the constraint is lower-bounded.
* - Can form the infinite interval: lower_bound = -infinity and
* upper_bound = +infinity. The constraint is free.
*
*
* Protobuf type {@code operations_research.MPConstraintProto}
*/
public final class MPConstraintProto extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:operations_research.MPConstraintProto)
MPConstraintProtoOrBuilder {
private static final long serialVersionUID = 0L;
// Use MPConstraintProto.newBuilder() to construct.
private MPConstraintProto(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
}
private MPConstraintProto() {
varIndex_ = emptyIntList();
coefficient_ = emptyDoubleList();
lowerBound_ = Double.NEGATIVE_INFINITY;
upperBound_ = Double.POSITIVE_INFINITY;
name_ = "";
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new MPConstraintProto();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private MPConstraintProto(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 17: {
bitField0_ |= 0x00000001;
lowerBound_ = input.readDouble();
break;
}
case 25: {
bitField0_ |= 0x00000002;
upperBound_ = input.readDouble();
break;
}
case 34: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000004;
name_ = bs;
break;
}
case 40: {
bitField0_ |= 0x00000008;
isLazy_ = input.readBool();
break;
}
case 48: {
if (!((mutable_bitField0_ & 0x00000001) != 0)) {
varIndex_ = newIntList();
mutable_bitField0_ |= 0x00000001;
}
varIndex_.addInt(input.readInt32());
break;
}
case 50: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000001) != 0) && input.getBytesUntilLimit() > 0) {
varIndex_ = newIntList();
mutable_bitField0_ |= 0x00000001;
}
while (input.getBytesUntilLimit() > 0) {
varIndex_.addInt(input.readInt32());
}
input.popLimit(limit);
break;
}
case 57: {
if (!((mutable_bitField0_ & 0x00000002) != 0)) {
coefficient_ = newDoubleList();
mutable_bitField0_ |= 0x00000002;
}
coefficient_.addDouble(input.readDouble());
break;
}
case 58: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000002) != 0) && input.getBytesUntilLimit() > 0) {
coefficient_ = newDoubleList();
mutable_bitField0_ |= 0x00000002;
}
while (input.getBytesUntilLimit() > 0) {
coefficient_.addDouble(input.readDouble());
}
input.popLimit(limit);
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) != 0)) {
varIndex_.makeImmutable(); // C
}
if (((mutable_bitField0_ & 0x00000002) != 0)) {
coefficient_.makeImmutable(); // C
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPConstraintProto_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPConstraintProto_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.ortools.linearsolver.MPConstraintProto.class, com.google.ortools.linearsolver.MPConstraintProto.Builder.class);
}
private int bitField0_;
public static final int VAR_INDEX_FIELD_NUMBER = 6;
private com.google.protobuf.Internal.IntList varIndex_;
/**
*
* var_index[i] is the variable index (w.r.t. to "variable" field of
* MPModelProto) of the i-th linear term involved in this constraint, and
* coefficient[i] is its coefficient. Only the terms with non-zero
* coefficients need to appear. var_index may not contain duplicates.
*
*
* repeated int32 var_index = 6 [packed = true];
* @return A list containing the varIndex.
*/
@java.lang.Override
public java.util.List
getVarIndexList() {
return varIndex_;
}
/**
*
* var_index[i] is the variable index (w.r.t. to "variable" field of
* MPModelProto) of the i-th linear term involved in this constraint, and
* coefficient[i] is its coefficient. Only the terms with non-zero
* coefficients need to appear. var_index may not contain duplicates.
*
*
* repeated int32 var_index = 6 [packed = true];
* @return The count of varIndex.
*/
public int getVarIndexCount() {
return varIndex_.size();
}
/**
*
* var_index[i] is the variable index (w.r.t. to "variable" field of
* MPModelProto) of the i-th linear term involved in this constraint, and
* coefficient[i] is its coefficient. Only the terms with non-zero
* coefficients need to appear. var_index may not contain duplicates.
*
*
* repeated int32 var_index = 6 [packed = true];
* @param index The index of the element to return.
* @return The varIndex at the given index.
*/
public int getVarIndex(int index) {
return varIndex_.getInt(index);
}
private int varIndexMemoizedSerializedSize = -1;
public static final int COEFFICIENT_FIELD_NUMBER = 7;
private com.google.protobuf.Internal.DoubleList coefficient_;
/**
*
* Must be finite.
*
*
* repeated double coefficient = 7 [packed = true];
* @return A list containing the coefficient.
*/
@java.lang.Override
public java.util.List
getCoefficientList() {
return coefficient_;
}
/**
*
* Must be finite.
*
*
* repeated double coefficient = 7 [packed = true];
* @return The count of coefficient.
*/
public int getCoefficientCount() {
return coefficient_.size();
}
/**
*
* Must be finite.
*
*
* repeated double coefficient = 7 [packed = true];
* @param index The index of the element to return.
* @return The coefficient at the given index.
*/
public double getCoefficient(int index) {
return coefficient_.getDouble(index);
}
private int coefficientMemoizedSerializedSize = -1;
public static final int LOWER_BOUND_FIELD_NUMBER = 2;
private double lowerBound_;
/**
*
* lower_bound must be <= upper_bound.
*
*
* optional double lower_bound = 2 [default = -inf];
* @return Whether the lowerBound field is set.
*/
@java.lang.Override
public boolean hasLowerBound() {
return ((bitField0_ & 0x00000001) != 0);
}
/**
*
* lower_bound must be <= upper_bound.
*
*
* optional double lower_bound = 2 [default = -inf];
* @return The lowerBound.
*/
@java.lang.Override
public double getLowerBound() {
return lowerBound_;
}
public static final int UPPER_BOUND_FIELD_NUMBER = 3;
private double upperBound_;
/**
* optional double upper_bound = 3 [default = inf];
* @return Whether the upperBound field is set.
*/
@java.lang.Override
public boolean hasUpperBound() {
return ((bitField0_ & 0x00000002) != 0);
}
/**
* optional double upper_bound = 3 [default = inf];
* @return The upperBound.
*/
@java.lang.Override
public double getUpperBound() {
return upperBound_;
}
public static final int NAME_FIELD_NUMBER = 4;
private volatile java.lang.Object name_;
/**
*
* The name of the constraint.
*
*
* optional string name = 4 [default = ""];
* @return Whether the name field is set.
*/
@java.lang.Override
public boolean hasName() {
return ((bitField0_ & 0x00000004) != 0);
}
/**
*
* The name of the constraint.
*
*
* optional string name = 4 [default = ""];
* @return The name.
*/
@java.lang.Override
public java.lang.String getName() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
name_ = s;
}
return s;
}
}
/**
*
* The name of the constraint.
*
*
* optional string name = 4 [default = ""];
* @return The bytes for name.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int IS_LAZY_FIELD_NUMBER = 5;
private boolean isLazy_;
/**
*
* [Advanced usage: do not use this if you don't know what you're doing.]
* A lazy constraint is handled differently by the core solving engine, but
* it does not change the result. It may or may not impact the performance.
* For more info see: http://tinyurl.com/lazy-constraints.
*
*
* optional bool is_lazy = 5 [default = false];
* @return Whether the isLazy field is set.
*/
@java.lang.Override
public boolean hasIsLazy() {
return ((bitField0_ & 0x00000008) != 0);
}
/**
*
* [Advanced usage: do not use this if you don't know what you're doing.]
* A lazy constraint is handled differently by the core solving engine, but
* it does not change the result. It may or may not impact the performance.
* For more info see: http://tinyurl.com/lazy-constraints.
*
*
* optional bool is_lazy = 5 [default = false];
* @return The isLazy.
*/
@java.lang.Override
public boolean getIsLazy() {
return isLazy_;
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) != 0)) {
output.writeDouble(2, lowerBound_);
}
if (((bitField0_ & 0x00000002) != 0)) {
output.writeDouble(3, upperBound_);
}
if (((bitField0_ & 0x00000004) != 0)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 4, name_);
}
if (((bitField0_ & 0x00000008) != 0)) {
output.writeBool(5, isLazy_);
}
if (getVarIndexList().size() > 0) {
output.writeUInt32NoTag(50);
output.writeUInt32NoTag(varIndexMemoizedSerializedSize);
}
for (int i = 0; i < varIndex_.size(); i++) {
output.writeInt32NoTag(varIndex_.getInt(i));
}
if (getCoefficientList().size() > 0) {
output.writeUInt32NoTag(58);
output.writeUInt32NoTag(coefficientMemoizedSerializedSize);
}
for (int i = 0; i < coefficient_.size(); i++) {
output.writeDoubleNoTag(coefficient_.getDouble(i));
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) != 0)) {
size += com.google.protobuf.CodedOutputStream
.computeDoubleSize(2, lowerBound_);
}
if (((bitField0_ & 0x00000002) != 0)) {
size += com.google.protobuf.CodedOutputStream
.computeDoubleSize(3, upperBound_);
}
if (((bitField0_ & 0x00000004) != 0)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, name_);
}
if (((bitField0_ & 0x00000008) != 0)) {
size += com.google.protobuf.CodedOutputStream
.computeBoolSize(5, isLazy_);
}
{
int dataSize = 0;
for (int i = 0; i < varIndex_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(varIndex_.getInt(i));
}
size += dataSize;
if (!getVarIndexList().isEmpty()) {
size += 1;
size += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
varIndexMemoizedSerializedSize = dataSize;
}
{
int dataSize = 0;
dataSize = 8 * getCoefficientList().size();
size += dataSize;
if (!getCoefficientList().isEmpty()) {
size += 1;
size += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
coefficientMemoizedSerializedSize = dataSize;
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.google.ortools.linearsolver.MPConstraintProto)) {
return super.equals(obj);
}
com.google.ortools.linearsolver.MPConstraintProto other = (com.google.ortools.linearsolver.MPConstraintProto) obj;
if (!getVarIndexList()
.equals(other.getVarIndexList())) return false;
if (!getCoefficientList()
.equals(other.getCoefficientList())) return false;
if (hasLowerBound() != other.hasLowerBound()) return false;
if (hasLowerBound()) {
if (java.lang.Double.doubleToLongBits(getLowerBound())
!= java.lang.Double.doubleToLongBits(
other.getLowerBound())) return false;
}
if (hasUpperBound() != other.hasUpperBound()) return false;
if (hasUpperBound()) {
if (java.lang.Double.doubleToLongBits(getUpperBound())
!= java.lang.Double.doubleToLongBits(
other.getUpperBound())) return false;
}
if (hasName() != other.hasName()) return false;
if (hasName()) {
if (!getName()
.equals(other.getName())) return false;
}
if (hasIsLazy() != other.hasIsLazy()) return false;
if (hasIsLazy()) {
if (getIsLazy()
!= other.getIsLazy()) return false;
}
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
if (getVarIndexCount() > 0) {
hash = (37 * hash) + VAR_INDEX_FIELD_NUMBER;
hash = (53 * hash) + getVarIndexList().hashCode();
}
if (getCoefficientCount() > 0) {
hash = (37 * hash) + COEFFICIENT_FIELD_NUMBER;
hash = (53 * hash) + getCoefficientList().hashCode();
}
if (hasLowerBound()) {
hash = (37 * hash) + LOWER_BOUND_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
java.lang.Double.doubleToLongBits(getLowerBound()));
}
if (hasUpperBound()) {
hash = (37 * hash) + UPPER_BOUND_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
java.lang.Double.doubleToLongBits(getUpperBound()));
}
if (hasName()) {
hash = (37 * hash) + NAME_FIELD_NUMBER;
hash = (53 * hash) + getName().hashCode();
}
if (hasIsLazy()) {
hash = (37 * hash) + IS_LAZY_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
getIsLazy());
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.google.ortools.linearsolver.MPConstraintProto parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.ortools.linearsolver.MPConstraintProto parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.ortools.linearsolver.MPConstraintProto parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.ortools.linearsolver.MPConstraintProto parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.ortools.linearsolver.MPConstraintProto parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.ortools.linearsolver.MPConstraintProto parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.ortools.linearsolver.MPConstraintProto parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.ortools.linearsolver.MPConstraintProto parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static com.google.ortools.linearsolver.MPConstraintProto parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static com.google.ortools.linearsolver.MPConstraintProto parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static com.google.ortools.linearsolver.MPConstraintProto parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.ortools.linearsolver.MPConstraintProto parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(com.google.ortools.linearsolver.MPConstraintProto prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
*
* A linear constraint is always of the form:
* lower_bound <= sum of linear term elements <= upper_bound,
* where lower_bound and upper_bound:
* - Can form a singleton: lower_bound == upper_bound. The constraint is an
* equation.
* - Can form a finite interval [lower_bound, upper_bound]. The constraint is
* both lower- and upper-bounded, i.e. "boxed".
* - Can form a semi-infinite interval. lower_bound = -infinity: the constraint
* is upper-bounded. upper_bound = +infinity: the constraint is lower-bounded.
* - Can form the infinite interval: lower_bound = -infinity and
* upper_bound = +infinity. The constraint is free.
*
*
* Protobuf type {@code operations_research.MPConstraintProto}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder implements
// @@protoc_insertion_point(builder_implements:operations_research.MPConstraintProto)
com.google.ortools.linearsolver.MPConstraintProtoOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPConstraintProto_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPConstraintProto_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.ortools.linearsolver.MPConstraintProto.class, com.google.ortools.linearsolver.MPConstraintProto.Builder.class);
}
// Construct using com.google.ortools.linearsolver.MPConstraintProto.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
varIndex_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000001);
coefficient_ = emptyDoubleList();
bitField0_ = (bitField0_ & ~0x00000002);
lowerBound_ = Double.NEGATIVE_INFINITY;
bitField0_ = (bitField0_ & ~0x00000004);
upperBound_ = Double.POSITIVE_INFINITY;
bitField0_ = (bitField0_ & ~0x00000008);
name_ = "";
bitField0_ = (bitField0_ & ~0x00000010);
isLazy_ = false;
bitField0_ = (bitField0_ & ~0x00000020);
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPConstraintProto_descriptor;
}
@java.lang.Override
public com.google.ortools.linearsolver.MPConstraintProto getDefaultInstanceForType() {
return com.google.ortools.linearsolver.MPConstraintProto.getDefaultInstance();
}
@java.lang.Override
public com.google.ortools.linearsolver.MPConstraintProto build() {
com.google.ortools.linearsolver.MPConstraintProto result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.google.ortools.linearsolver.MPConstraintProto buildPartial() {
com.google.ortools.linearsolver.MPConstraintProto result = new com.google.ortools.linearsolver.MPConstraintProto(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((bitField0_ & 0x00000001) != 0)) {
varIndex_.makeImmutable();
bitField0_ = (bitField0_ & ~0x00000001);
}
result.varIndex_ = varIndex_;
if (((bitField0_ & 0x00000002) != 0)) {
coefficient_.makeImmutable();
bitField0_ = (bitField0_ & ~0x00000002);
}
result.coefficient_ = coefficient_;
if (((from_bitField0_ & 0x00000004) != 0)) {
to_bitField0_ |= 0x00000001;
}
result.lowerBound_ = lowerBound_;
if (((from_bitField0_ & 0x00000008) != 0)) {
to_bitField0_ |= 0x00000002;
}
result.upperBound_ = upperBound_;
if (((from_bitField0_ & 0x00000010) != 0)) {
to_bitField0_ |= 0x00000004;
}
result.name_ = name_;
if (((from_bitField0_ & 0x00000020) != 0)) {
result.isLazy_ = isLazy_;
to_bitField0_ |= 0x00000008;
}
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.google.ortools.linearsolver.MPConstraintProto) {
return mergeFrom((com.google.ortools.linearsolver.MPConstraintProto)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.ortools.linearsolver.MPConstraintProto other) {
if (other == com.google.ortools.linearsolver.MPConstraintProto.getDefaultInstance()) return this;
if (!other.varIndex_.isEmpty()) {
if (varIndex_.isEmpty()) {
varIndex_ = other.varIndex_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureVarIndexIsMutable();
varIndex_.addAll(other.varIndex_);
}
onChanged();
}
if (!other.coefficient_.isEmpty()) {
if (coefficient_.isEmpty()) {
coefficient_ = other.coefficient_;
bitField0_ = (bitField0_ & ~0x00000002);
} else {
ensureCoefficientIsMutable();
coefficient_.addAll(other.coefficient_);
}
onChanged();
}
if (other.hasLowerBound()) {
setLowerBound(other.getLowerBound());
}
if (other.hasUpperBound()) {
setUpperBound(other.getUpperBound());
}
if (other.hasName()) {
bitField0_ |= 0x00000010;
name_ = other.name_;
onChanged();
}
if (other.hasIsLazy()) {
setIsLazy(other.getIsLazy());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.google.ortools.linearsolver.MPConstraintProto parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.google.ortools.linearsolver.MPConstraintProto) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private com.google.protobuf.Internal.IntList varIndex_ = emptyIntList();
private void ensureVarIndexIsMutable() {
if (!((bitField0_ & 0x00000001) != 0)) {
varIndex_ = mutableCopy(varIndex_);
bitField0_ |= 0x00000001;
}
}
/**
*
* var_index[i] is the variable index (w.r.t. to "variable" field of
* MPModelProto) of the i-th linear term involved in this constraint, and
* coefficient[i] is its coefficient. Only the terms with non-zero
* coefficients need to appear. var_index may not contain duplicates.
*
*
* repeated int32 var_index = 6 [packed = true];
* @return A list containing the varIndex.
*/
public java.util.List
getVarIndexList() {
return ((bitField0_ & 0x00000001) != 0) ?
java.util.Collections.unmodifiableList(varIndex_) : varIndex_;
}
/**
*
* var_index[i] is the variable index (w.r.t. to "variable" field of
* MPModelProto) of the i-th linear term involved in this constraint, and
* coefficient[i] is its coefficient. Only the terms with non-zero
* coefficients need to appear. var_index may not contain duplicates.
*
*
* repeated int32 var_index = 6 [packed = true];
* @return The count of varIndex.
*/
public int getVarIndexCount() {
return varIndex_.size();
}
/**
*
* var_index[i] is the variable index (w.r.t. to "variable" field of
* MPModelProto) of the i-th linear term involved in this constraint, and
* coefficient[i] is its coefficient. Only the terms with non-zero
* coefficients need to appear. var_index may not contain duplicates.
*
*
* repeated int32 var_index = 6 [packed = true];
* @param index The index of the element to return.
* @return The varIndex at the given index.
*/
public int getVarIndex(int index) {
return varIndex_.getInt(index);
}
/**
*
* var_index[i] is the variable index (w.r.t. to "variable" field of
* MPModelProto) of the i-th linear term involved in this constraint, and
* coefficient[i] is its coefficient. Only the terms with non-zero
* coefficients need to appear. var_index may not contain duplicates.
*
*
* repeated int32 var_index = 6 [packed = true];
* @param index The index to set the value at.
* @param value The varIndex to set.
* @return This builder for chaining.
*/
public Builder setVarIndex(
int index, int value) {
ensureVarIndexIsMutable();
varIndex_.setInt(index, value);
onChanged();
return this;
}
/**
*
* var_index[i] is the variable index (w.r.t. to "variable" field of
* MPModelProto) of the i-th linear term involved in this constraint, and
* coefficient[i] is its coefficient. Only the terms with non-zero
* coefficients need to appear. var_index may not contain duplicates.
*
*
* repeated int32 var_index = 6 [packed = true];
* @param value The varIndex to add.
* @return This builder for chaining.
*/
public Builder addVarIndex(int value) {
ensureVarIndexIsMutable();
varIndex_.addInt(value);
onChanged();
return this;
}
/**
*
* var_index[i] is the variable index (w.r.t. to "variable" field of
* MPModelProto) of the i-th linear term involved in this constraint, and
* coefficient[i] is its coefficient. Only the terms with non-zero
* coefficients need to appear. var_index may not contain duplicates.
*
*
* repeated int32 var_index = 6 [packed = true];
* @param values The varIndex to add.
* @return This builder for chaining.
*/
public Builder addAllVarIndex(
java.lang.Iterable extends java.lang.Integer> values) {
ensureVarIndexIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, varIndex_);
onChanged();
return this;
}
/**
*
* var_index[i] is the variable index (w.r.t. to "variable" field of
* MPModelProto) of the i-th linear term involved in this constraint, and
* coefficient[i] is its coefficient. Only the terms with non-zero
* coefficients need to appear. var_index may not contain duplicates.
*
*
* repeated int32 var_index = 6 [packed = true];
* @return This builder for chaining.
*/
public Builder clearVarIndex() {
varIndex_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
private com.google.protobuf.Internal.DoubleList coefficient_ = emptyDoubleList();
private void ensureCoefficientIsMutable() {
if (!((bitField0_ & 0x00000002) != 0)) {
coefficient_ = mutableCopy(coefficient_);
bitField0_ |= 0x00000002;
}
}
/**
*
* Must be finite.
*
*
* repeated double coefficient = 7 [packed = true];
* @return A list containing the coefficient.
*/
public java.util.List
getCoefficientList() {
return ((bitField0_ & 0x00000002) != 0) ?
java.util.Collections.unmodifiableList(coefficient_) : coefficient_;
}
/**
*
* Must be finite.
*
*
* repeated double coefficient = 7 [packed = true];
* @return The count of coefficient.
*/
public int getCoefficientCount() {
return coefficient_.size();
}
/**
*
* Must be finite.
*
*
* repeated double coefficient = 7 [packed = true];
* @param index The index of the element to return.
* @return The coefficient at the given index.
*/
public double getCoefficient(int index) {
return coefficient_.getDouble(index);
}
/**
*
* Must be finite.
*
*
* repeated double coefficient = 7 [packed = true];
* @param index The index to set the value at.
* @param value The coefficient to set.
* @return This builder for chaining.
*/
public Builder setCoefficient(
int index, double value) {
ensureCoefficientIsMutable();
coefficient_.setDouble(index, value);
onChanged();
return this;
}
/**
*
* Must be finite.
*
*
* repeated double coefficient = 7 [packed = true];
* @param value The coefficient to add.
* @return This builder for chaining.
*/
public Builder addCoefficient(double value) {
ensureCoefficientIsMutable();
coefficient_.addDouble(value);
onChanged();
return this;
}
/**
*
* Must be finite.
*
*
* repeated double coefficient = 7 [packed = true];
* @param values The coefficient to add.
* @return This builder for chaining.
*/
public Builder addAllCoefficient(
java.lang.Iterable extends java.lang.Double> values) {
ensureCoefficientIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, coefficient_);
onChanged();
return this;
}
/**
*
* Must be finite.
*
*
* repeated double coefficient = 7 [packed = true];
* @return This builder for chaining.
*/
public Builder clearCoefficient() {
coefficient_ = emptyDoubleList();
bitField0_ = (bitField0_ & ~0x00000002);
onChanged();
return this;
}
private double lowerBound_ = Double.NEGATIVE_INFINITY;
/**
*
* lower_bound must be <= upper_bound.
*
*
* optional double lower_bound = 2 [default = -inf];
* @return Whether the lowerBound field is set.
*/
@java.lang.Override
public boolean hasLowerBound() {
return ((bitField0_ & 0x00000004) != 0);
}
/**
*
* lower_bound must be <= upper_bound.
*
*
* optional double lower_bound = 2 [default = -inf];
* @return The lowerBound.
*/
@java.lang.Override
public double getLowerBound() {
return lowerBound_;
}
/**
*
* lower_bound must be <= upper_bound.
*
*
* optional double lower_bound = 2 [default = -inf];
* @param value The lowerBound to set.
* @return This builder for chaining.
*/
public Builder setLowerBound(double value) {
bitField0_ |= 0x00000004;
lowerBound_ = value;
onChanged();
return this;
}
/**
*
* lower_bound must be <= upper_bound.
*
*
* optional double lower_bound = 2 [default = -inf];
* @return This builder for chaining.
*/
public Builder clearLowerBound() {
bitField0_ = (bitField0_ & ~0x00000004);
lowerBound_ = Double.NEGATIVE_INFINITY;
onChanged();
return this;
}
private double upperBound_ = Double.POSITIVE_INFINITY;
/**
* optional double upper_bound = 3 [default = inf];
* @return Whether the upperBound field is set.
*/
@java.lang.Override
public boolean hasUpperBound() {
return ((bitField0_ & 0x00000008) != 0);
}
/**
* optional double upper_bound = 3 [default = inf];
* @return The upperBound.
*/
@java.lang.Override
public double getUpperBound() {
return upperBound_;
}
/**
* optional double upper_bound = 3 [default = inf];
* @param value The upperBound to set.
* @return This builder for chaining.
*/
public Builder setUpperBound(double value) {
bitField0_ |= 0x00000008;
upperBound_ = value;
onChanged();
return this;
}
/**
* optional double upper_bound = 3 [default = inf];
* @return This builder for chaining.
*/
public Builder clearUpperBound() {
bitField0_ = (bitField0_ & ~0x00000008);
upperBound_ = Double.POSITIVE_INFINITY;
onChanged();
return this;
}
private java.lang.Object name_ = "";
/**
*
* The name of the constraint.
*
*
* optional string name = 4 [default = ""];
* @return Whether the name field is set.
*/
public boolean hasName() {
return ((bitField0_ & 0x00000010) != 0);
}
/**
*
* The name of the constraint.
*
*
* optional string name = 4 [default = ""];
* @return The name.
*/
public java.lang.String getName() {
java.lang.Object ref = name_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
name_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
* The name of the constraint.
*
*
* optional string name = 4 [default = ""];
* @return The bytes for name.
*/
public com.google.protobuf.ByteString
getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
* The name of the constraint.
*
*
* optional string name = 4 [default = ""];
* @param value The name to set.
* @return This builder for chaining.
*/
public Builder setName(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000010;
name_ = value;
onChanged();
return this;
}
/**
*
* The name of the constraint.
*
*
* optional string name = 4 [default = ""];
* @return This builder for chaining.
*/
public Builder clearName() {
bitField0_ = (bitField0_ & ~0x00000010);
name_ = getDefaultInstance().getName();
onChanged();
return this;
}
/**
*
* The name of the constraint.
*
*
* optional string name = 4 [default = ""];
* @param value The bytes for name to set.
* @return This builder for chaining.
*/
public Builder setNameBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000010;
name_ = value;
onChanged();
return this;
}
private boolean isLazy_ ;
/**
*
* [Advanced usage: do not use this if you don't know what you're doing.]
* A lazy constraint is handled differently by the core solving engine, but
* it does not change the result. It may or may not impact the performance.
* For more info see: http://tinyurl.com/lazy-constraints.
*
*
* optional bool is_lazy = 5 [default = false];
* @return Whether the isLazy field is set.
*/
@java.lang.Override
public boolean hasIsLazy() {
return ((bitField0_ & 0x00000020) != 0);
}
/**
*
* [Advanced usage: do not use this if you don't know what you're doing.]
* A lazy constraint is handled differently by the core solving engine, but
* it does not change the result. It may or may not impact the performance.
* For more info see: http://tinyurl.com/lazy-constraints.
*
*
* optional bool is_lazy = 5 [default = false];
* @return The isLazy.
*/
@java.lang.Override
public boolean getIsLazy() {
return isLazy_;
}
/**
*
* [Advanced usage: do not use this if you don't know what you're doing.]
* A lazy constraint is handled differently by the core solving engine, but
* it does not change the result. It may or may not impact the performance.
* For more info see: http://tinyurl.com/lazy-constraints.
*
*
* optional bool is_lazy = 5 [default = false];
* @param value The isLazy to set.
* @return This builder for chaining.
*/
public Builder setIsLazy(boolean value) {
bitField0_ |= 0x00000020;
isLazy_ = value;
onChanged();
return this;
}
/**
*
* [Advanced usage: do not use this if you don't know what you're doing.]
* A lazy constraint is handled differently by the core solving engine, but
* it does not change the result. It may or may not impact the performance.
* For more info see: http://tinyurl.com/lazy-constraints.
*
*
* optional bool is_lazy = 5 [default = false];
* @return This builder for chaining.
*/
public Builder clearIsLazy() {
bitField0_ = (bitField0_ & ~0x00000020);
isLazy_ = false;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:operations_research.MPConstraintProto)
}
// @@protoc_insertion_point(class_scope:operations_research.MPConstraintProto)
private static final com.google.ortools.linearsolver.MPConstraintProto DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.ortools.linearsolver.MPConstraintProto();
}
public static com.google.ortools.linearsolver.MPConstraintProto getDefaultInstance() {
return DEFAULT_INSTANCE;
}
@java.lang.Deprecated public static final com.google.protobuf.Parser
PARSER = new com.google.protobuf.AbstractParser() {
@java.lang.Override
public MPConstraintProto parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new MPConstraintProto(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser getParserForType() {
return PARSER;
}
@java.lang.Override
public com.google.ortools.linearsolver.MPConstraintProto getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy