com.google.ortools.sat.RoutesConstraintProto Maven / Gradle / Ivy
The newest version!
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: ortools/sat/cp_model.proto
package com.google.ortools.sat;
/**
*
* The "VRP" (Vehicle Routing Problem) constraint.
* The direct graph where arc #i (from tails[i] to head[i]) is present iff
* literals[i] is true must satisfy this set of properties:
* - #incoming arcs == 1 except for node 0.
* - #outgoing arcs == 1 except for node 0.
* - for node zero, #incoming arcs == #outgoing arcs.
* - There are no duplicate arcs.
* - Self-arcs are allowed except for node 0.
* - There is no cycle in this graph, except through node 0.
* TODO(user): It is probably possible to generalize this constraint to a
* no-cycle in a general graph, or a no-cycle with sum incoming <= 1 and sum
* outgoing <= 1 (more efficient implementation). On the other hand, having this
* specific constraint allow us to add specific "cuts" to a VRP problem.
*
*
* Protobuf type {@code operations_research.sat.RoutesConstraintProto}
*/
public final class RoutesConstraintProto extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:operations_research.sat.RoutesConstraintProto)
RoutesConstraintProtoOrBuilder {
private static final long serialVersionUID = 0L;
// Use RoutesConstraintProto.newBuilder() to construct.
private RoutesConstraintProto(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
}
private RoutesConstraintProto() {
tails_ = emptyIntList();
heads_ = emptyIntList();
literals_ = emptyIntList();
demands_ = emptyIntList();
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new RoutesConstraintProto();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private RoutesConstraintProto(
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 8: {
if (!((mutable_bitField0_ & 0x00000001) != 0)) {
tails_ = newIntList();
mutable_bitField0_ |= 0x00000001;
}
tails_.addInt(input.readInt32());
break;
}
case 10: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000001) != 0) && input.getBytesUntilLimit() > 0) {
tails_ = newIntList();
mutable_bitField0_ |= 0x00000001;
}
while (input.getBytesUntilLimit() > 0) {
tails_.addInt(input.readInt32());
}
input.popLimit(limit);
break;
}
case 16: {
if (!((mutable_bitField0_ & 0x00000002) != 0)) {
heads_ = newIntList();
mutable_bitField0_ |= 0x00000002;
}
heads_.addInt(input.readInt32());
break;
}
case 18: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000002) != 0) && input.getBytesUntilLimit() > 0) {
heads_ = newIntList();
mutable_bitField0_ |= 0x00000002;
}
while (input.getBytesUntilLimit() > 0) {
heads_.addInt(input.readInt32());
}
input.popLimit(limit);
break;
}
case 24: {
if (!((mutable_bitField0_ & 0x00000004) != 0)) {
literals_ = newIntList();
mutable_bitField0_ |= 0x00000004;
}
literals_.addInt(input.readInt32());
break;
}
case 26: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000004) != 0) && input.getBytesUntilLimit() > 0) {
literals_ = newIntList();
mutable_bitField0_ |= 0x00000004;
}
while (input.getBytesUntilLimit() > 0) {
literals_.addInt(input.readInt32());
}
input.popLimit(limit);
break;
}
case 32: {
if (!((mutable_bitField0_ & 0x00000008) != 0)) {
demands_ = newIntList();
mutable_bitField0_ |= 0x00000008;
}
demands_.addInt(input.readInt32());
break;
}
case 34: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000008) != 0) && input.getBytesUntilLimit() > 0) {
demands_ = newIntList();
mutable_bitField0_ |= 0x00000008;
}
while (input.getBytesUntilLimit() > 0) {
demands_.addInt(input.readInt32());
}
input.popLimit(limit);
break;
}
case 40: {
capacity_ = input.readInt64();
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)) {
tails_.makeImmutable(); // C
}
if (((mutable_bitField0_ & 0x00000002) != 0)) {
heads_.makeImmutable(); // C
}
if (((mutable_bitField0_ & 0x00000004) != 0)) {
literals_.makeImmutable(); // C
}
if (((mutable_bitField0_ & 0x00000008) != 0)) {
demands_.makeImmutable(); // C
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.ortools.sat.CpModelProtobuf.internal_static_operations_research_sat_RoutesConstraintProto_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.ortools.sat.CpModelProtobuf.internal_static_operations_research_sat_RoutesConstraintProto_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.ortools.sat.RoutesConstraintProto.class, com.google.ortools.sat.RoutesConstraintProto.Builder.class);
}
public static final int TAILS_FIELD_NUMBER = 1;
private com.google.protobuf.Internal.IntList tails_;
/**
* repeated int32 tails = 1;
* @return A list containing the tails.
*/
@java.lang.Override
public java.util.List
getTailsList() {
return tails_;
}
/**
* repeated int32 tails = 1;
* @return The count of tails.
*/
public int getTailsCount() {
return tails_.size();
}
/**
* repeated int32 tails = 1;
* @param index The index of the element to return.
* @return The tails at the given index.
*/
public int getTails(int index) {
return tails_.getInt(index);
}
private int tailsMemoizedSerializedSize = -1;
public static final int HEADS_FIELD_NUMBER = 2;
private com.google.protobuf.Internal.IntList heads_;
/**
* repeated int32 heads = 2;
* @return A list containing the heads.
*/
@java.lang.Override
public java.util.List
getHeadsList() {
return heads_;
}
/**
* repeated int32 heads = 2;
* @return The count of heads.
*/
public int getHeadsCount() {
return heads_.size();
}
/**
* repeated int32 heads = 2;
* @param index The index of the element to return.
* @return The heads at the given index.
*/
public int getHeads(int index) {
return heads_.getInt(index);
}
private int headsMemoizedSerializedSize = -1;
public static final int LITERALS_FIELD_NUMBER = 3;
private com.google.protobuf.Internal.IntList literals_;
/**
* repeated int32 literals = 3;
* @return A list containing the literals.
*/
@java.lang.Override
public java.util.List
getLiteralsList() {
return literals_;
}
/**
* repeated int32 literals = 3;
* @return The count of literals.
*/
public int getLiteralsCount() {
return literals_.size();
}
/**
* repeated int32 literals = 3;
* @param index The index of the element to return.
* @return The literals at the given index.
*/
public int getLiterals(int index) {
return literals_.getInt(index);
}
private int literalsMemoizedSerializedSize = -1;
public static final int DEMANDS_FIELD_NUMBER = 4;
private com.google.protobuf.Internal.IntList demands_;
/**
*
* Experimental. The demands for each node, and the maximum capacity for each
* route. Note that this is currently only used for the LP relaxation and one
* need to add the corresponding constraint to enforce this outside of the LP.
*
*
* repeated int32 demands = 4;
* @return A list containing the demands.
*/
@java.lang.Override
public java.util.List
getDemandsList() {
return demands_;
}
/**
*
* Experimental. The demands for each node, and the maximum capacity for each
* route. Note that this is currently only used for the LP relaxation and one
* need to add the corresponding constraint to enforce this outside of the LP.
*
*
* repeated int32 demands = 4;
* @return The count of demands.
*/
public int getDemandsCount() {
return demands_.size();
}
/**
*
* Experimental. The demands for each node, and the maximum capacity for each
* route. Note that this is currently only used for the LP relaxation and one
* need to add the corresponding constraint to enforce this outside of the LP.
*
*
* repeated int32 demands = 4;
* @param index The index of the element to return.
* @return The demands at the given index.
*/
public int getDemands(int index) {
return demands_.getInt(index);
}
private int demandsMemoizedSerializedSize = -1;
public static final int CAPACITY_FIELD_NUMBER = 5;
private long capacity_;
/**
* int64 capacity = 5;
* @return The capacity.
*/
@java.lang.Override
public long getCapacity() {
return capacity_;
}
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 (getTailsList().size() > 0) {
output.writeUInt32NoTag(10);
output.writeUInt32NoTag(tailsMemoizedSerializedSize);
}
for (int i = 0; i < tails_.size(); i++) {
output.writeInt32NoTag(tails_.getInt(i));
}
if (getHeadsList().size() > 0) {
output.writeUInt32NoTag(18);
output.writeUInt32NoTag(headsMemoizedSerializedSize);
}
for (int i = 0; i < heads_.size(); i++) {
output.writeInt32NoTag(heads_.getInt(i));
}
if (getLiteralsList().size() > 0) {
output.writeUInt32NoTag(26);
output.writeUInt32NoTag(literalsMemoizedSerializedSize);
}
for (int i = 0; i < literals_.size(); i++) {
output.writeInt32NoTag(literals_.getInt(i));
}
if (getDemandsList().size() > 0) {
output.writeUInt32NoTag(34);
output.writeUInt32NoTag(demandsMemoizedSerializedSize);
}
for (int i = 0; i < demands_.size(); i++) {
output.writeInt32NoTag(demands_.getInt(i));
}
if (capacity_ != 0L) {
output.writeInt64(5, capacity_);
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
{
int dataSize = 0;
for (int i = 0; i < tails_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(tails_.getInt(i));
}
size += dataSize;
if (!getTailsList().isEmpty()) {
size += 1;
size += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
tailsMemoizedSerializedSize = dataSize;
}
{
int dataSize = 0;
for (int i = 0; i < heads_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(heads_.getInt(i));
}
size += dataSize;
if (!getHeadsList().isEmpty()) {
size += 1;
size += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
headsMemoizedSerializedSize = dataSize;
}
{
int dataSize = 0;
for (int i = 0; i < literals_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(literals_.getInt(i));
}
size += dataSize;
if (!getLiteralsList().isEmpty()) {
size += 1;
size += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
literalsMemoizedSerializedSize = dataSize;
}
{
int dataSize = 0;
for (int i = 0; i < demands_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(demands_.getInt(i));
}
size += dataSize;
if (!getDemandsList().isEmpty()) {
size += 1;
size += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
demandsMemoizedSerializedSize = dataSize;
}
if (capacity_ != 0L) {
size += com.google.protobuf.CodedOutputStream
.computeInt64Size(5, capacity_);
}
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.sat.RoutesConstraintProto)) {
return super.equals(obj);
}
com.google.ortools.sat.RoutesConstraintProto other = (com.google.ortools.sat.RoutesConstraintProto) obj;
if (!getTailsList()
.equals(other.getTailsList())) return false;
if (!getHeadsList()
.equals(other.getHeadsList())) return false;
if (!getLiteralsList()
.equals(other.getLiteralsList())) return false;
if (!getDemandsList()
.equals(other.getDemandsList())) return false;
if (getCapacity()
!= other.getCapacity()) 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 (getTailsCount() > 0) {
hash = (37 * hash) + TAILS_FIELD_NUMBER;
hash = (53 * hash) + getTailsList().hashCode();
}
if (getHeadsCount() > 0) {
hash = (37 * hash) + HEADS_FIELD_NUMBER;
hash = (53 * hash) + getHeadsList().hashCode();
}
if (getLiteralsCount() > 0) {
hash = (37 * hash) + LITERALS_FIELD_NUMBER;
hash = (53 * hash) + getLiteralsList().hashCode();
}
if (getDemandsCount() > 0) {
hash = (37 * hash) + DEMANDS_FIELD_NUMBER;
hash = (53 * hash) + getDemandsList().hashCode();
}
hash = (37 * hash) + CAPACITY_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getCapacity());
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.google.ortools.sat.RoutesConstraintProto parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.ortools.sat.RoutesConstraintProto 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.sat.RoutesConstraintProto parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.ortools.sat.RoutesConstraintProto 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.sat.RoutesConstraintProto parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.ortools.sat.RoutesConstraintProto parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.ortools.sat.RoutesConstraintProto parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.ortools.sat.RoutesConstraintProto 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.sat.RoutesConstraintProto parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static com.google.ortools.sat.RoutesConstraintProto 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.sat.RoutesConstraintProto parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.ortools.sat.RoutesConstraintProto 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.sat.RoutesConstraintProto 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;
}
/**
*
* The "VRP" (Vehicle Routing Problem) constraint.
* The direct graph where arc #i (from tails[i] to head[i]) is present iff
* literals[i] is true must satisfy this set of properties:
* - #incoming arcs == 1 except for node 0.
* - #outgoing arcs == 1 except for node 0.
* - for node zero, #incoming arcs == #outgoing arcs.
* - There are no duplicate arcs.
* - Self-arcs are allowed except for node 0.
* - There is no cycle in this graph, except through node 0.
* TODO(user): It is probably possible to generalize this constraint to a
* no-cycle in a general graph, or a no-cycle with sum incoming <= 1 and sum
* outgoing <= 1 (more efficient implementation). On the other hand, having this
* specific constraint allow us to add specific "cuts" to a VRP problem.
*
*
* Protobuf type {@code operations_research.sat.RoutesConstraintProto}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder implements
// @@protoc_insertion_point(builder_implements:operations_research.sat.RoutesConstraintProto)
com.google.ortools.sat.RoutesConstraintProtoOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.ortools.sat.CpModelProtobuf.internal_static_operations_research_sat_RoutesConstraintProto_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.ortools.sat.CpModelProtobuf.internal_static_operations_research_sat_RoutesConstraintProto_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.ortools.sat.RoutesConstraintProto.class, com.google.ortools.sat.RoutesConstraintProto.Builder.class);
}
// Construct using com.google.ortools.sat.RoutesConstraintProto.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();
tails_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000001);
heads_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000002);
literals_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000004);
demands_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000008);
capacity_ = 0L;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.google.ortools.sat.CpModelProtobuf.internal_static_operations_research_sat_RoutesConstraintProto_descriptor;
}
@java.lang.Override
public com.google.ortools.sat.RoutesConstraintProto getDefaultInstanceForType() {
return com.google.ortools.sat.RoutesConstraintProto.getDefaultInstance();
}
@java.lang.Override
public com.google.ortools.sat.RoutesConstraintProto build() {
com.google.ortools.sat.RoutesConstraintProto result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.google.ortools.sat.RoutesConstraintProto buildPartial() {
com.google.ortools.sat.RoutesConstraintProto result = new com.google.ortools.sat.RoutesConstraintProto(this);
int from_bitField0_ = bitField0_;
if (((bitField0_ & 0x00000001) != 0)) {
tails_.makeImmutable();
bitField0_ = (bitField0_ & ~0x00000001);
}
result.tails_ = tails_;
if (((bitField0_ & 0x00000002) != 0)) {
heads_.makeImmutable();
bitField0_ = (bitField0_ & ~0x00000002);
}
result.heads_ = heads_;
if (((bitField0_ & 0x00000004) != 0)) {
literals_.makeImmutable();
bitField0_ = (bitField0_ & ~0x00000004);
}
result.literals_ = literals_;
if (((bitField0_ & 0x00000008) != 0)) {
demands_.makeImmutable();
bitField0_ = (bitField0_ & ~0x00000008);
}
result.demands_ = demands_;
result.capacity_ = capacity_;
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.sat.RoutesConstraintProto) {
return mergeFrom((com.google.ortools.sat.RoutesConstraintProto)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.ortools.sat.RoutesConstraintProto other) {
if (other == com.google.ortools.sat.RoutesConstraintProto.getDefaultInstance()) return this;
if (!other.tails_.isEmpty()) {
if (tails_.isEmpty()) {
tails_ = other.tails_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureTailsIsMutable();
tails_.addAll(other.tails_);
}
onChanged();
}
if (!other.heads_.isEmpty()) {
if (heads_.isEmpty()) {
heads_ = other.heads_;
bitField0_ = (bitField0_ & ~0x00000002);
} else {
ensureHeadsIsMutable();
heads_.addAll(other.heads_);
}
onChanged();
}
if (!other.literals_.isEmpty()) {
if (literals_.isEmpty()) {
literals_ = other.literals_;
bitField0_ = (bitField0_ & ~0x00000004);
} else {
ensureLiteralsIsMutable();
literals_.addAll(other.literals_);
}
onChanged();
}
if (!other.demands_.isEmpty()) {
if (demands_.isEmpty()) {
demands_ = other.demands_;
bitField0_ = (bitField0_ & ~0x00000008);
} else {
ensureDemandsIsMutable();
demands_.addAll(other.demands_);
}
onChanged();
}
if (other.getCapacity() != 0L) {
setCapacity(other.getCapacity());
}
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.sat.RoutesConstraintProto parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.google.ortools.sat.RoutesConstraintProto) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private com.google.protobuf.Internal.IntList tails_ = emptyIntList();
private void ensureTailsIsMutable() {
if (!((bitField0_ & 0x00000001) != 0)) {
tails_ = mutableCopy(tails_);
bitField0_ |= 0x00000001;
}
}
/**
* repeated int32 tails = 1;
* @return A list containing the tails.
*/
public java.util.List
getTailsList() {
return ((bitField0_ & 0x00000001) != 0) ?
java.util.Collections.unmodifiableList(tails_) : tails_;
}
/**
* repeated int32 tails = 1;
* @return The count of tails.
*/
public int getTailsCount() {
return tails_.size();
}
/**
* repeated int32 tails = 1;
* @param index The index of the element to return.
* @return The tails at the given index.
*/
public int getTails(int index) {
return tails_.getInt(index);
}
/**
* repeated int32 tails = 1;
* @param index The index to set the value at.
* @param value The tails to set.
* @return This builder for chaining.
*/
public Builder setTails(
int index, int value) {
ensureTailsIsMutable();
tails_.setInt(index, value);
onChanged();
return this;
}
/**
* repeated int32 tails = 1;
* @param value The tails to add.
* @return This builder for chaining.
*/
public Builder addTails(int value) {
ensureTailsIsMutable();
tails_.addInt(value);
onChanged();
return this;
}
/**
* repeated int32 tails = 1;
* @param values The tails to add.
* @return This builder for chaining.
*/
public Builder addAllTails(
java.lang.Iterable extends java.lang.Integer> values) {
ensureTailsIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, tails_);
onChanged();
return this;
}
/**
* repeated int32 tails = 1;
* @return This builder for chaining.
*/
public Builder clearTails() {
tails_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
private com.google.protobuf.Internal.IntList heads_ = emptyIntList();
private void ensureHeadsIsMutable() {
if (!((bitField0_ & 0x00000002) != 0)) {
heads_ = mutableCopy(heads_);
bitField0_ |= 0x00000002;
}
}
/**
* repeated int32 heads = 2;
* @return A list containing the heads.
*/
public java.util.List
getHeadsList() {
return ((bitField0_ & 0x00000002) != 0) ?
java.util.Collections.unmodifiableList(heads_) : heads_;
}
/**
* repeated int32 heads = 2;
* @return The count of heads.
*/
public int getHeadsCount() {
return heads_.size();
}
/**
* repeated int32 heads = 2;
* @param index The index of the element to return.
* @return The heads at the given index.
*/
public int getHeads(int index) {
return heads_.getInt(index);
}
/**
* repeated int32 heads = 2;
* @param index The index to set the value at.
* @param value The heads to set.
* @return This builder for chaining.
*/
public Builder setHeads(
int index, int value) {
ensureHeadsIsMutable();
heads_.setInt(index, value);
onChanged();
return this;
}
/**
* repeated int32 heads = 2;
* @param value The heads to add.
* @return This builder for chaining.
*/
public Builder addHeads(int value) {
ensureHeadsIsMutable();
heads_.addInt(value);
onChanged();
return this;
}
/**
* repeated int32 heads = 2;
* @param values The heads to add.
* @return This builder for chaining.
*/
public Builder addAllHeads(
java.lang.Iterable extends java.lang.Integer> values) {
ensureHeadsIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, heads_);
onChanged();
return this;
}
/**
* repeated int32 heads = 2;
* @return This builder for chaining.
*/
public Builder clearHeads() {
heads_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000002);
onChanged();
return this;
}
private com.google.protobuf.Internal.IntList literals_ = emptyIntList();
private void ensureLiteralsIsMutable() {
if (!((bitField0_ & 0x00000004) != 0)) {
literals_ = mutableCopy(literals_);
bitField0_ |= 0x00000004;
}
}
/**
* repeated int32 literals = 3;
* @return A list containing the literals.
*/
public java.util.List
getLiteralsList() {
return ((bitField0_ & 0x00000004) != 0) ?
java.util.Collections.unmodifiableList(literals_) : literals_;
}
/**
* repeated int32 literals = 3;
* @return The count of literals.
*/
public int getLiteralsCount() {
return literals_.size();
}
/**
* repeated int32 literals = 3;
* @param index The index of the element to return.
* @return The literals at the given index.
*/
public int getLiterals(int index) {
return literals_.getInt(index);
}
/**
* repeated int32 literals = 3;
* @param index The index to set the value at.
* @param value The literals to set.
* @return This builder for chaining.
*/
public Builder setLiterals(
int index, int value) {
ensureLiteralsIsMutable();
literals_.setInt(index, value);
onChanged();
return this;
}
/**
* repeated int32 literals = 3;
* @param value The literals to add.
* @return This builder for chaining.
*/
public Builder addLiterals(int value) {
ensureLiteralsIsMutable();
literals_.addInt(value);
onChanged();
return this;
}
/**
* repeated int32 literals = 3;
* @param values The literals to add.
* @return This builder for chaining.
*/
public Builder addAllLiterals(
java.lang.Iterable extends java.lang.Integer> values) {
ensureLiteralsIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, literals_);
onChanged();
return this;
}
/**
* repeated int32 literals = 3;
* @return This builder for chaining.
*/
public Builder clearLiterals() {
literals_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000004);
onChanged();
return this;
}
private com.google.protobuf.Internal.IntList demands_ = emptyIntList();
private void ensureDemandsIsMutable() {
if (!((bitField0_ & 0x00000008) != 0)) {
demands_ = mutableCopy(demands_);
bitField0_ |= 0x00000008;
}
}
/**
*
* Experimental. The demands for each node, and the maximum capacity for each
* route. Note that this is currently only used for the LP relaxation and one
* need to add the corresponding constraint to enforce this outside of the LP.
*
*
* repeated int32 demands = 4;
* @return A list containing the demands.
*/
public java.util.List
getDemandsList() {
return ((bitField0_ & 0x00000008) != 0) ?
java.util.Collections.unmodifiableList(demands_) : demands_;
}
/**
*
* Experimental. The demands for each node, and the maximum capacity for each
* route. Note that this is currently only used for the LP relaxation and one
* need to add the corresponding constraint to enforce this outside of the LP.
*
*
* repeated int32 demands = 4;
* @return The count of demands.
*/
public int getDemandsCount() {
return demands_.size();
}
/**
*
* Experimental. The demands for each node, and the maximum capacity for each
* route. Note that this is currently only used for the LP relaxation and one
* need to add the corresponding constraint to enforce this outside of the LP.
*
*
* repeated int32 demands = 4;
* @param index The index of the element to return.
* @return The demands at the given index.
*/
public int getDemands(int index) {
return demands_.getInt(index);
}
/**
*
* Experimental. The demands for each node, and the maximum capacity for each
* route. Note that this is currently only used for the LP relaxation and one
* need to add the corresponding constraint to enforce this outside of the LP.
*
*
* repeated int32 demands = 4;
* @param index The index to set the value at.
* @param value The demands to set.
* @return This builder for chaining.
*/
public Builder setDemands(
int index, int value) {
ensureDemandsIsMutable();
demands_.setInt(index, value);
onChanged();
return this;
}
/**
*
* Experimental. The demands for each node, and the maximum capacity for each
* route. Note that this is currently only used for the LP relaxation and one
* need to add the corresponding constraint to enforce this outside of the LP.
*
*
* repeated int32 demands = 4;
* @param value The demands to add.
* @return This builder for chaining.
*/
public Builder addDemands(int value) {
ensureDemandsIsMutable();
demands_.addInt(value);
onChanged();
return this;
}
/**
*
* Experimental. The demands for each node, and the maximum capacity for each
* route. Note that this is currently only used for the LP relaxation and one
* need to add the corresponding constraint to enforce this outside of the LP.
*
*
* repeated int32 demands = 4;
* @param values The demands to add.
* @return This builder for chaining.
*/
public Builder addAllDemands(
java.lang.Iterable extends java.lang.Integer> values) {
ensureDemandsIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, demands_);
onChanged();
return this;
}
/**
*
* Experimental. The demands for each node, and the maximum capacity for each
* route. Note that this is currently only used for the LP relaxation and one
* need to add the corresponding constraint to enforce this outside of the LP.
*
*
* repeated int32 demands = 4;
* @return This builder for chaining.
*/
public Builder clearDemands() {
demands_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000008);
onChanged();
return this;
}
private long capacity_ ;
/**
* int64 capacity = 5;
* @return The capacity.
*/
@java.lang.Override
public long getCapacity() {
return capacity_;
}
/**
* int64 capacity = 5;
* @param value The capacity to set.
* @return This builder for chaining.
*/
public Builder setCapacity(long value) {
capacity_ = value;
onChanged();
return this;
}
/**
* int64 capacity = 5;
* @return This builder for chaining.
*/
public Builder clearCapacity() {
capacity_ = 0L;
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.sat.RoutesConstraintProto)
}
// @@protoc_insertion_point(class_scope:operations_research.sat.RoutesConstraintProto)
private static final com.google.ortools.sat.RoutesConstraintProto DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.ortools.sat.RoutesConstraintProto();
}
public static com.google.ortools.sat.RoutesConstraintProto getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser
PARSER = new com.google.protobuf.AbstractParser() {
@java.lang.Override
public RoutesConstraintProto parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new RoutesConstraintProto(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.sat.RoutesConstraintProto getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy