6package com.google.ortools.linearsolver;
21public final class MPQuadraticConstraint
extends
22 com.google.protobuf.GeneratedMessage implements
25private static final long serialVersionUID = 0L;
27 com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
28 com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
33 MPQuadraticConstraint.class.getName());
36 private MPQuadraticConstraint(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
39 private MPQuadraticConstraint() {
40 varIndex_ = emptyIntList();
41 coefficient_ = emptyDoubleList();
42 qvar1Index_ = emptyIntList();
43 qvar2Index_ = emptyIntList();
44 qcoefficient_ = emptyDoubleList();
45 lowerBound_ = Double.NEGATIVE_INFINITY;
46 upperBound_ = Double.POSITIVE_INFINITY;
49 public static final com.google.protobuf.Descriptors.Descriptor
51 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPQuadraticConstraint_descriptor;
55 protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
57 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPQuadraticConstraint_fieldAccessorTable
58 .ensureFieldAccessorsInitialized(
59 com.google.ortools.linearsolver.MPQuadraticConstraint.class, com.google.ortools.linearsolver.MPQuadraticConstraint.Builder.class);
62 private int bitField0_;
64 @SuppressWarnings(
"serial")
65 private com.google.protobuf.Internal.IntList varIndex_ =
79 public java.
util.List<java.lang.Integer>
95 return varIndex_.size();
110 return varIndex_.getInt(index);
114 @SuppressWarnings(
"serial")
115 private com.google.protobuf.Internal.DoubleList coefficient_ =
126 public java.
util.List<java.lang.Double>
139 return coefficient_.size();
151 return coefficient_.getDouble(index);
155 @SuppressWarnings(
"serial")
156 private com.google.protobuf.Internal.IntList qvar1Index_ =
173 public java.
util.List<java.lang.Integer>
192 return qvar1Index_.size();
210 return qvar1Index_.getInt(index);
214 @SuppressWarnings(
"serial")
215 private com.google.protobuf.Internal.IntList qvar2Index_ =
222 public java.
util.List<java.lang.Integer>
231 return qvar2Index_.size();
239 return qvar2Index_.getInt(index);
243 @SuppressWarnings(
"serial")
244 private com.google.protobuf.Internal.DoubleList qcoefficient_ =
255 public java.
util.List<java.lang.Double>
257 return qcoefficient_;
268 return qcoefficient_.size();
280 return qcoefficient_.getDouble(index);
284 private double lowerBound_ = Double.NEGATIVE_INFINITY;
295 return ((bitField0_ & 0x00000001) != 0);
311 private double upperBound_ = Double.POSITIVE_INFINITY;
318 return ((bitField0_ & 0x00000002) != 0);
329 private byte memoizedIsInitialized = -1;
336 memoizedIsInitialized = 1;
341 public void writeTo(com.google.protobuf.CodedOutputStream output)
342 throws java.io.IOException {
343 for (
int i = 0; i < varIndex_.size(); i++) {
344 output.writeInt32(1, varIndex_.getInt(i));
346 for (
int i = 0; i < coefficient_.size(); i++) {
347 output.writeDouble(2, coefficient_.getDouble(i));
349 for (
int i = 0; i < qvar1Index_.size(); i++) {
350 output.writeInt32(3, qvar1Index_.getInt(i));
352 for (
int i = 0; i < qvar2Index_.size(); i++) {
353 output.writeInt32(4, qvar2Index_.getInt(i));
355 for (
int i = 0; i < qcoefficient_.size(); i++) {
356 output.writeDouble(5, qcoefficient_.getDouble(i));
358 if (((bitField0_ & 0x00000001) != 0)) {
359 output.writeDouble(6, lowerBound_);
361 if (((bitField0_ & 0x00000002) != 0)) {
362 output.writeDouble(7, upperBound_);
364 getUnknownFields().writeTo(output);
369 int size = memoizedSize;
370 if (size != -1)
return size;
375 for (
int i = 0; i < varIndex_.size(); i++) {
376 dataSize += com.google.protobuf.CodedOutputStream
377 .computeInt32SizeNoTag(varIndex_.getInt(i));
390 for (
int i = 0; i < qvar1Index_.size(); i++) {
391 dataSize += com.google.protobuf.CodedOutputStream
392 .computeInt32SizeNoTag(qvar1Index_.getInt(i));
399 for (
int i = 0; i < qvar2Index_.size(); i++) {
400 dataSize += com.google.protobuf.CodedOutputStream
401 .computeInt32SizeNoTag(qvar2Index_.getInt(i));
412 if (((bitField0_ & 0x00000001) != 0)) {
413 size += com.google.protobuf.CodedOutputStream
414 .computeDoubleSize(6, lowerBound_);
416 if (((bitField0_ & 0x00000002) != 0)) {
417 size += com.google.protobuf.CodedOutputStream
418 .computeDoubleSize(7, upperBound_);
420 size += getUnknownFields().getSerializedSize();
426 public boolean equals(
final java.lang.Object obj) {
430 if (!(obj instanceof com.google.ortools.linearsolver.MPQuadraticConstraint)) {
431 return super.equals(obj);
448 != java.lang.Double.doubleToLongBits(
454 != java.lang.Double.doubleToLongBits(
457 if (!getUnknownFields().
equals(other.getUnknownFields()))
return false;
463 if (memoizedHashCode != 0) {
464 return memoizedHashCode;
490 hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
495 hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
498 hash = (29 * hash) + getUnknownFields().hashCode();
499 memoizedHashCode = hash;
504 java.nio.ByteBuffer data)
505 throws com.google.protobuf.InvalidProtocolBufferException {
506 return PARSER.parseFrom(data);
509 java.nio.ByteBuffer data,
510 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
511 throws com.google.protobuf.InvalidProtocolBufferException {
512 return PARSER.parseFrom(data, extensionRegistry);
515 com.google.protobuf.ByteString data)
516 throws com.google.protobuf.InvalidProtocolBufferException {
517 return PARSER.parseFrom(data);
520 com.google.protobuf.ByteString data,
521 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
522 throws com.google.protobuf.InvalidProtocolBufferException {
523 return PARSER.parseFrom(data, extensionRegistry);
526 throws com.google.protobuf.InvalidProtocolBufferException {
527 return PARSER.parseFrom(data);
531 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
532 throws com.google.protobuf.InvalidProtocolBufferException {
533 return PARSER.parseFrom(data, extensionRegistry);
536 throws java.io.IOException {
537 return com.google.protobuf.GeneratedMessage
538 .parseWithIOException(PARSER, input);
541 java.io.InputStream input,
542 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
543 throws java.io.IOException {
544 return com.google.protobuf.GeneratedMessage
545 .parseWithIOException(PARSER, input, extensionRegistry);
549 throws java.io.IOException {
550 return com.google.protobuf.GeneratedMessage
551 .parseDelimitedWithIOException(PARSER, input);
555 java.io.InputStream input,
556 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
557 throws java.io.IOException {
558 return com.google.protobuf.GeneratedMessage
559 .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
562 com.google.protobuf.CodedInputStream input)
563 throws java.io.IOException {
564 return com.google.protobuf.GeneratedMessage
565 .parseWithIOException(PARSER, input);
568 com.google.protobuf.CodedInputStream input,
569 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
570 throws java.io.IOException {
571 return com.google.protobuf.GeneratedMessage
572 .parseWithIOException(PARSER, input, extensionRegistry);
578 return DEFAULT_INSTANCE.toBuilder();
580 public static Builder newBuilder(com.google.ortools.linearsolver.MPQuadraticConstraint prototype) {
581 return DEFAULT_INSTANCE.toBuilder().
mergeFrom(prototype);
585 return this == DEFAULT_INSTANCE
591 com.google.protobuf.GeneratedMessage.BuilderParent parent) {
608 public static final class Builder
extends
609 com.google.protobuf.GeneratedMessage.Builder<Builder> implements
612 public static final com.google.protobuf.Descriptors.Descriptor
614 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPQuadraticConstraint_descriptor;
618 protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
620 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPQuadraticConstraint_fieldAccessorTable
621 .ensureFieldAccessorsInitialized(
622 com.google.ortools.linearsolver.MPQuadraticConstraint.class, com.google.ortools.linearsolver.MPQuadraticConstraint.Builder.class);
631 com.google.protobuf.GeneratedMessage.BuilderParent parent) {
639 varIndex_ = emptyIntList();
640 coefficient_ = emptyDoubleList();
641 qvar1Index_ = emptyIntList();
642 qvar2Index_ = emptyIntList();
643 qcoefficient_ = emptyDoubleList();
644 lowerBound_ = Double.NEGATIVE_INFINITY;
645 upperBound_ = Double.POSITIVE_INFINITY;
650 public com.google.protobuf.Descriptors.Descriptor
652 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPQuadraticConstraint_descriptor;
657 return com.google.ortools.linearsolver.MPQuadraticConstraint.getDefaultInstance();
664 throw newUninitializedMessageException(result);
672 if (bitField0_ != 0) { buildPartial0(result); }
677 private void buildPartial0(com.google.ortools.linearsolver.MPQuadraticConstraint result) {
678 int from_bitField0_ = bitField0_;
679 if (((from_bitField0_ & 0x00000001) != 0)) {
680 varIndex_.makeImmutable();
681 result.varIndex_ = varIndex_;
683 if (((from_bitField0_ & 0x00000002) != 0)) {
684 coefficient_.makeImmutable();
685 result.coefficient_ = coefficient_;
687 if (((from_bitField0_ & 0x00000004) != 0)) {
688 qvar1Index_.makeImmutable();
689 result.qvar1Index_ = qvar1Index_;
691 if (((from_bitField0_ & 0x00000008) != 0)) {
692 qvar2Index_.makeImmutable();
693 result.qvar2Index_ = qvar2Index_;
695 if (((from_bitField0_ & 0x00000010) != 0)) {
696 qcoefficient_.makeImmutable();
697 result.qcoefficient_ = qcoefficient_;
699 int to_bitField0_ = 0;
700 if (((from_bitField0_ & 0x00000020) != 0)) {
701 result.lowerBound_ = lowerBound_;
702 to_bitField0_ |= 0x00000001;
704 if (((from_bitField0_ & 0x00000040) != 0)) {
705 result.upperBound_ = upperBound_;
706 to_bitField0_ |= 0x00000002;
708 result.bitField0_ |= to_bitField0_;
712 public Builder
mergeFrom(com.google.protobuf.Message other) {
713 if (other instanceof com.google.ortools.linearsolver.MPQuadraticConstraint) {
714 return mergeFrom((com.google.ortools.linearsolver.MPQuadraticConstraint)other);
716 super.mergeFrom(other);
721 public Builder
mergeFrom(com.google.ortools.linearsolver.MPQuadraticConstraint other) {
722 if (other == com.google.ortools.linearsolver.MPQuadraticConstraint.getDefaultInstance())
return this;
723 if (!other.varIndex_.isEmpty()) {
724 if (varIndex_.isEmpty()) {
725 varIndex_ = other.varIndex_;
726 varIndex_.makeImmutable();
727 bitField0_ |= 0x00000001;
729 ensureVarIndexIsMutable();
730 varIndex_.addAll(other.varIndex_);
734 if (!other.coefficient_.isEmpty()) {
735 if (coefficient_.isEmpty()) {
736 coefficient_ = other.coefficient_;
737 coefficient_.makeImmutable();
738 bitField0_ |= 0x00000002;
740 ensureCoefficientIsMutable();
741 coefficient_.addAll(other.coefficient_);
745 if (!other.qvar1Index_.isEmpty()) {
746 if (qvar1Index_.isEmpty()) {
747 qvar1Index_ = other.qvar1Index_;
748 qvar1Index_.makeImmutable();
749 bitField0_ |= 0x00000004;
751 ensureQvar1IndexIsMutable();
752 qvar1Index_.addAll(other.qvar1Index_);
756 if (!other.qvar2Index_.isEmpty()) {
757 if (qvar2Index_.isEmpty()) {
758 qvar2Index_ = other.qvar2Index_;
759 qvar2Index_.makeImmutable();
760 bitField0_ |= 0x00000008;
762 ensureQvar2IndexIsMutable();
763 qvar2Index_.addAll(other.qvar2Index_);
767 if (!other.qcoefficient_.isEmpty()) {
768 if (qcoefficient_.isEmpty()) {
769 qcoefficient_ = other.qcoefficient_;
770 qcoefficient_.makeImmutable();
771 bitField0_ |= 0x00000010;
773 ensureQcoefficientIsMutable();
774 qcoefficient_.addAll(other.qcoefficient_);
778 if (other.hasLowerBound()) {
781 if (other.hasUpperBound()) {
784 this.mergeUnknownFields(other.getUnknownFields());
796 com.google.protobuf.CodedInputStream input,
797 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
798 throws java.io.IOException {
799 if (extensionRegistry ==
null) {
800 throw new java.lang.NullPointerException();
803 boolean done =
false;
805 int tag = input.readTag();
811 int v = input.readInt32();
812 ensureVarIndexIsMutable();
817 int length = input.readRawVarint32();
818 int limit = input.pushLimit(length);
819 ensureVarIndexIsMutable();
820 while (input.getBytesUntilLimit() > 0) {
821 varIndex_.addInt(input.readInt32());
823 input.popLimit(limit);
827 double v = input.readDouble();
828 ensureCoefficientIsMutable();
829 coefficient_.addDouble(v);
833 int length = input.readRawVarint32();
834 int limit = input.pushLimit(length);
835 int alloc = length > 4096 ? 4096 : length;
836 ensureCoefficientIsMutable(alloc / 8);
837 while (input.getBytesUntilLimit() > 0) {
838 coefficient_.addDouble(input.readDouble());
840 input.popLimit(limit);
844 int v = input.readInt32();
845 ensureQvar1IndexIsMutable();
846 qvar1Index_.addInt(v);
850 int length = input.readRawVarint32();
851 int limit = input.pushLimit(length);
852 ensureQvar1IndexIsMutable();
853 while (input.getBytesUntilLimit() > 0) {
854 qvar1Index_.addInt(input.readInt32());
856 input.popLimit(limit);
860 int v = input.readInt32();
861 ensureQvar2IndexIsMutable();
862 qvar2Index_.addInt(v);
866 int length = input.readRawVarint32();
867 int limit = input.pushLimit(length);
868 ensureQvar2IndexIsMutable();
869 while (input.getBytesUntilLimit() > 0) {
870 qvar2Index_.addInt(input.readInt32());
872 input.popLimit(limit);
876 double v = input.readDouble();
877 ensureQcoefficientIsMutable();
878 qcoefficient_.addDouble(v);
882 int length = input.readRawVarint32();
883 int limit = input.pushLimit(length);
884 int alloc = length > 4096 ? 4096 : length;
885 ensureQcoefficientIsMutable(alloc / 8);
886 while (input.getBytesUntilLimit() > 0) {
887 qcoefficient_.addDouble(input.readDouble());
889 input.popLimit(limit);
893 lowerBound_ = input.readDouble();
894 bitField0_ |= 0x00000020;
898 upperBound_ = input.readDouble();
899 bitField0_ |= 0x00000040;
903 if (!super.parseUnknownField(input, extensionRegistry, tag)) {
910 }
catch (com.google.protobuf.InvalidProtocolBufferException e) {
911 throw e.unwrapIOException();
917 private int bitField0_;
919 private com.google.protobuf.Internal.IntList varIndex_ = emptyIntList();
920 private void ensureVarIndexIsMutable() {
921 if (!varIndex_.isModifiable()) {
922 varIndex_ = makeMutableCopy(varIndex_);
924 bitField0_ |= 0x00000001;
937 public java.util.List<java.lang.Integer>
939 varIndex_.makeImmutable();
954 return varIndex_.size();
969 return varIndex_.getInt(index);
985 int index,
int value) {
987 ensureVarIndexIsMutable();
988 varIndex_.setInt(index, value);
989 bitField0_ |= 0x00000001;
1007 ensureVarIndexIsMutable();
1008 varIndex_.addInt(value);
1009 bitField0_ |= 0x00000001;
1026 java.lang.Iterable<? extends java.lang.Integer> values) {
1027 ensureVarIndexIsMutable();
1028 com.google.protobuf.AbstractMessageLite.Builder.addAll(
1030 bitField0_ |= 0x00000001;
1046 varIndex_ = emptyIntList();
1047 bitField0_ = (bitField0_ & ~0x00000001);
1052 private com.google.protobuf.Internal.DoubleList coefficient_ = emptyDoubleList();
1053 private void ensureCoefficientIsMutable() {
1054 if (!coefficient_.isModifiable()) {
1055 coefficient_ = makeMutableCopy(coefficient_);
1057 bitField0_ |= 0x00000002;
1059 private void ensureCoefficientIsMutable(
int capacity) {
1060 if (!coefficient_.isModifiable()) {
1061 coefficient_ = makeMutableCopy(coefficient_, capacity);
1063 bitField0_ |= 0x00000002;
1073 public java.util.List<java.lang.Double>
1075 coefficient_.makeImmutable();
1076 return coefficient_;
1087 return coefficient_.size();
1099 return coefficient_.getDouble(index);
1112 int index,
double value) {
1114 ensureCoefficientIsMutable();
1115 coefficient_.setDouble(index, value);
1116 bitField0_ |= 0x00000002;
1131 ensureCoefficientIsMutable();
1132 coefficient_.addDouble(value);
1133 bitField0_ |= 0x00000002;
1147 java.lang.Iterable<? extends java.lang.Double> values) {
1148 ensureCoefficientIsMutable();
1149 com.google.protobuf.AbstractMessageLite.Builder.addAll(
1150 values, coefficient_);
1151 bitField0_ |= 0x00000002;
1164 coefficient_ = emptyDoubleList();
1165 bitField0_ = (bitField0_ & ~0x00000002);
1170 private com.google.protobuf.Internal.IntList qvar1Index_ = emptyIntList();
1171 private void ensureQvar1IndexIsMutable() {
1172 if (!qvar1Index_.isModifiable()) {
1173 qvar1Index_ = makeMutableCopy(qvar1Index_);
1175 bitField0_ |= 0x00000004;
1191 public java.util.List<java.lang.Integer>
1193 qvar1Index_.makeImmutable();
1211 return qvar1Index_.size();
1229 return qvar1Index_.getInt(index);
1248 int index,
int value) {
1250 ensureQvar1IndexIsMutable();
1251 qvar1Index_.setInt(index, value);
1252 bitField0_ |= 0x00000004;
1273 ensureQvar1IndexIsMutable();
1274 qvar1Index_.addInt(value);
1275 bitField0_ |= 0x00000004;
1295 java.lang.Iterable<? extends java.lang.Integer> values) {
1296 ensureQvar1IndexIsMutable();
1297 com.google.protobuf.AbstractMessageLite.Builder.addAll(
1298 values, qvar1Index_);
1299 bitField0_ |= 0x00000004;
1318 qvar1Index_ = emptyIntList();
1319 bitField0_ = (bitField0_ & ~0x00000004);
1324 private com.google.protobuf.Internal.IntList qvar2Index_ = emptyIntList();
1325 private void ensureQvar2IndexIsMutable() {
1326 if (!qvar2Index_.isModifiable()) {
1327 qvar2Index_ = makeMutableCopy(qvar2Index_);
1329 bitField0_ |= 0x00000008;
1335 public java.util.List<java.lang.Integer>
1337 qvar2Index_.makeImmutable();
1345 return qvar2Index_.size();
1353 return qvar2Index_.getInt(index);
1362 int index,
int value) {
1364 ensureQvar2IndexIsMutable();
1365 qvar2Index_.setInt(index, value);
1366 bitField0_ |= 0x00000008;
1377 ensureQvar2IndexIsMutable();
1378 qvar2Index_.addInt(value);
1379 bitField0_ |= 0x00000008;
1389 java.lang.Iterable<? extends java.lang.Integer> values) {
1390 ensureQvar2IndexIsMutable();
1391 com.google.protobuf.AbstractMessageLite.Builder.addAll(
1392 values, qvar2Index_);
1393 bitField0_ |= 0x00000008;
1402 qvar2Index_ = emptyIntList();
1403 bitField0_ = (bitField0_ & ~0x00000008);
1408 private com.google.protobuf.Internal.DoubleList qcoefficient_ = emptyDoubleList();
1409 private void ensureQcoefficientIsMutable() {
1410 if (!qcoefficient_.isModifiable()) {
1411 qcoefficient_ = makeMutableCopy(qcoefficient_);
1413 bitField0_ |= 0x00000010;
1415 private void ensureQcoefficientIsMutable(
int capacity) {
1416 if (!qcoefficient_.isModifiable()) {
1417 qcoefficient_ = makeMutableCopy(qcoefficient_, capacity);
1419 bitField0_ |= 0x00000010;
1429 public java.util.List<java.lang.Double>
1431 qcoefficient_.makeImmutable();
1432 return qcoefficient_;
1443 return qcoefficient_.size();
1455 return qcoefficient_.getDouble(index);
1468 int index,
double value) {
1470 ensureQcoefficientIsMutable();
1471 qcoefficient_.setDouble(index, value);
1472 bitField0_ |= 0x00000010;
1487 ensureQcoefficientIsMutable();
1488 qcoefficient_.addDouble(value);
1489 bitField0_ |= 0x00000010;
1503 java.lang.Iterable<? extends java.lang.Double> values) {
1504 ensureQcoefficientIsMutable();
1505 com.google.protobuf.AbstractMessageLite.Builder.addAll(
1506 values, qcoefficient_);
1507 bitField0_ |= 0x00000010;
1520 qcoefficient_ = emptyDoubleList();
1521 bitField0_ = (bitField0_ & ~0x00000010);
1526 private double lowerBound_ = Double.NEGATIVE_INFINITY;
1537 return ((bitField0_ & 0x00000020) != 0);
1562 lowerBound_ = value;
1563 bitField0_ |= 0x00000020;
1576 bitField0_ = (bitField0_ & ~0x00000020);
1577 lowerBound_ = Double.NEGATIVE_INFINITY;
1582 private double upperBound_ = Double.POSITIVE_INFINITY;
1589 return ((bitField0_ & 0x00000040) != 0);
1606 upperBound_ = value;
1607 bitField0_ |= 0x00000040;
1616 bitField0_ = (bitField0_ & ~0x00000040);
1617 upperBound_ = Double.POSITIVE_INFINITY;
1628 DEFAULT_INSTANCE =
new com.google.ortools.linearsolver.MPQuadraticConstraint();
1632 return DEFAULT_INSTANCE;
1639 com.google.protobuf.CodedInputStream input,
1640 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1641 throws com.google.protobuf.InvalidProtocolBufferException {
1644 builder.mergeFrom(input, extensionRegistry);
1645 }
catch (com.google.protobuf.InvalidProtocolBufferException e) {
1646 throw e.setUnfinishedMessage(builder.buildPartial());
1647 }
catch (com.google.protobuf.UninitializedMessageException e) {
1648 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
1649 }
catch (java.io.IOException e) {
1650 throw new com.google.protobuf.InvalidProtocolBufferException(e)
1651 .setUnfinishedMessage(builder.buildPartial());
1653 return builder.buildPartial();
1657 public static com.google.protobuf.Parser<MPQuadraticConstraint>
parser() {
1668 return DEFAULT_INSTANCE;