Google OR-Tools v9.9
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
MPSolution.java
Go to the documentation of this file.
1// Generated by the protocol buffer compiler. DO NOT EDIT!
2// source: ortools/linear_solver/linear_solver.proto
3
4// Protobuf Java Version: 3.25.3
5package com.google.ortools.linearsolver;
6
10public final class MPSolution extends
11 com.google.protobuf.GeneratedMessageV3 implements
12 // @@protoc_insertion_point(message_implements:operations_research.MPSolution)
14private static final long serialVersionUID = 0L;
15 // Use MPSolution.newBuilder() to construct.
16 private MPSolution(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
17 super(builder);
18 }
19 private MPSolution() {
20 variableValue_ = emptyDoubleList();
21 }
22
23 @java.lang.Override
24 @SuppressWarnings({"unused"})
25 protected java.lang.Object newInstance(
26 UnusedPrivateParameter unused) {
27 return new MPSolution();
28 }
29
30 public static final com.google.protobuf.Descriptors.Descriptor
32 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPSolution_descriptor;
33 }
34
35 @java.lang.Override
36 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
38 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPSolution_fieldAccessorTable
39 .ensureFieldAccessorsInitialized(
40 com.google.ortools.linearsolver.MPSolution.class, com.google.ortools.linearsolver.MPSolution.Builder.class);
41 }
42
43 private int bitField0_;
44 public static final int OBJECTIVE_VALUE_FIELD_NUMBER = 1;
45 private double objectiveValue_ = 0D;
50 @java.lang.Override
51 public boolean hasObjectiveValue() {
52 return ((bitField0_ & 0x00000001) != 0);
53 }
58 @java.lang.Override
59 public double getObjectiveValue() {
60 return objectiveValue_;
61 }
62
63 public static final int VARIABLE_VALUE_FIELD_NUMBER = 2;
64 @SuppressWarnings("serial")
65 private com.google.protobuf.Internal.DoubleList variableValue_ =
66 emptyDoubleList();
71 @java.lang.Override
72 public java.util.List<java.lang.Double>
74 return variableValue_;
75 }
80 public int getVariableValueCount() {
81 return variableValue_.size();
82 }
88 public double getVariableValue(int index) {
89 return variableValue_.getDouble(index);
90 }
91 private int variableValueMemoizedSerializedSize = -1;
92
93 private byte memoizedIsInitialized = -1;
94 @java.lang.Override
95 public final boolean isInitialized() {
96 byte isInitialized = memoizedIsInitialized;
97 if (isInitialized == 1) return true;
98 if (isInitialized == 0) return false;
99
100 memoizedIsInitialized = 1;
101 return true;
102 }
103
104 @java.lang.Override
105 public void writeTo(com.google.protobuf.CodedOutputStream output)
106 throws java.io.IOException {
108 if (((bitField0_ & 0x00000001) != 0)) {
109 output.writeDouble(1, objectiveValue_);
110 }
111 if (getVariableValueList().size() > 0) {
112 output.writeUInt32NoTag(18);
113 output.writeUInt32NoTag(variableValueMemoizedSerializedSize);
114 }
115 for (int i = 0; i < variableValue_.size(); i++) {
116 output.writeDoubleNoTag(variableValue_.getDouble(i));
117 }
118 getUnknownFields().writeTo(output);
119 }
120
121 @java.lang.Override
122 public int getSerializedSize() {
123 int size = memoizedSize;
124 if (size != -1) return size;
125
126 size = 0;
127 if (((bitField0_ & 0x00000001) != 0)) {
128 size += com.google.protobuf.CodedOutputStream
129 .computeDoubleSize(1, objectiveValue_);
130 }
131 {
132 int dataSize = 0;
133 dataSize = 8 * getVariableValueList().size();
134 size += dataSize;
135 if (!getVariableValueList().isEmpty()) {
136 size += 1;
137 size += com.google.protobuf.CodedOutputStream
138 .computeInt32SizeNoTag(dataSize);
139 }
140 variableValueMemoizedSerializedSize = dataSize;
141 }
142 size += getUnknownFields().getSerializedSize();
143 memoizedSize = size;
144 return size;
145 }
146
147 @java.lang.Override
148 public boolean equals(final java.lang.Object obj) {
149 if (obj == this) {
150 return true;
151 }
152 if (!(obj instanceof com.google.ortools.linearsolver.MPSolution)) {
153 return super.equals(obj);
154 }
155 com.google.ortools.linearsolver.MPSolution other = (com.google.ortools.linearsolver.MPSolution) obj;
156
157 if (hasObjectiveValue() != other.hasObjectiveValue()) return false;
158 if (hasObjectiveValue()) {
159 if (java.lang.Double.doubleToLongBits(getObjectiveValue())
160 != java.lang.Double.doubleToLongBits(
161 other.getObjectiveValue())) return false;
162 }
164 .equals(other.getVariableValueList())) return false;
165 if (!getUnknownFields().equals(other.getUnknownFields())) return false;
166 return true;
167 }
168
169 @java.lang.Override
170 public int hashCode() {
171 if (memoizedHashCode != 0) {
172 return memoizedHashCode;
173 }
174 int hash = 41;
175 hash = (19 * hash) + getDescriptor().hashCode();
176 if (hasObjectiveValue()) {
177 hash = (37 * hash) + OBJECTIVE_VALUE_FIELD_NUMBER;
178 hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
179 java.lang.Double.doubleToLongBits(getObjectiveValue()));
180 }
181 if (getVariableValueCount() > 0) {
182 hash = (37 * hash) + VARIABLE_VALUE_FIELD_NUMBER;
183 hash = (53 * hash) + getVariableValueList().hashCode();
184 }
185 hash = (29 * hash) + getUnknownFields().hashCode();
186 memoizedHashCode = hash;
187 return hash;
188 }
189
191 java.nio.ByteBuffer data)
192 throws com.google.protobuf.InvalidProtocolBufferException {
193 return PARSER.parseFrom(data);
194 }
196 java.nio.ByteBuffer data,
197 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
198 throws com.google.protobuf.InvalidProtocolBufferException {
199 return PARSER.parseFrom(data, extensionRegistry);
200 }
202 com.google.protobuf.ByteString data)
203 throws com.google.protobuf.InvalidProtocolBufferException {
204 return PARSER.parseFrom(data);
205 }
207 com.google.protobuf.ByteString data,
208 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
209 throws com.google.protobuf.InvalidProtocolBufferException {
210 return PARSER.parseFrom(data, extensionRegistry);
211 }
213 throws com.google.protobuf.InvalidProtocolBufferException {
214 return PARSER.parseFrom(data);
215 }
217 byte[] data,
218 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
219 throws com.google.protobuf.InvalidProtocolBufferException {
220 return PARSER.parseFrom(data, extensionRegistry);
221 }
222 public static com.google.ortools.linearsolver.MPSolution parseFrom(java.io.InputStream input)
223 throws java.io.IOException {
224 return com.google.protobuf.GeneratedMessageV3
225 .parseWithIOException(PARSER, input);
226 }
228 java.io.InputStream input,
229 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
230 throws java.io.IOException {
231 return com.google.protobuf.GeneratedMessageV3
232 .parseWithIOException(PARSER, input, extensionRegistry);
233 }
234
235 public static com.google.ortools.linearsolver.MPSolution parseDelimitedFrom(java.io.InputStream input)
236 throws java.io.IOException {
237 return com.google.protobuf.GeneratedMessageV3
238 .parseDelimitedWithIOException(PARSER, input);
239 }
240
242 java.io.InputStream input,
243 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
244 throws java.io.IOException {
245 return com.google.protobuf.GeneratedMessageV3
246 .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
247 }
249 com.google.protobuf.CodedInputStream input)
250 throws java.io.IOException {
251 return com.google.protobuf.GeneratedMessageV3
252 .parseWithIOException(PARSER, input);
253 }
255 com.google.protobuf.CodedInputStream input,
256 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
257 throws java.io.IOException {
258 return com.google.protobuf.GeneratedMessageV3
259 .parseWithIOException(PARSER, input, extensionRegistry);
260 }
261
262 @java.lang.Override
263 public Builder newBuilderForType() { return newBuilder(); }
264 public static Builder newBuilder() {
265 return DEFAULT_INSTANCE.toBuilder();
266 }
267 public static Builder newBuilder(com.google.ortools.linearsolver.MPSolution prototype) {
268 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
269 }
270 @java.lang.Override
272 return this == DEFAULT_INSTANCE
273 ? new Builder() : new Builder().mergeFrom(this);
274 }
275
276 @java.lang.Override
278 com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
279 Builder builder = new Builder(parent);
280 return builder;
281 }
285 public static final class Builder extends
286 com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
287 // @@protoc_insertion_point(builder_implements:operations_research.MPSolution)
288 com.google.ortools.linearsolver.MPSolutionOrBuilder {
289 public static final com.google.protobuf.Descriptors.Descriptor
291 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPSolution_descriptor;
292 }
293
294 @java.lang.Override
295 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
297 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPSolution_fieldAccessorTable
298 .ensureFieldAccessorsInitialized(
299 com.google.ortools.linearsolver.MPSolution.class, com.google.ortools.linearsolver.MPSolution.Builder.class);
300 }
301
302 // Construct using com.google.ortools.linearsolver.MPSolution.newBuilder()
303 private Builder() {
304
305 }
306
307 private Builder(
308 com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
309 super(parent);
310
311 }
312 @java.lang.Override
313 public Builder clear() {
314 super.clear();
315 bitField0_ = 0;
316 objectiveValue_ = 0D;
317 variableValue_ = emptyDoubleList();
318 return this;
319 }
320
321 @java.lang.Override
322 public com.google.protobuf.Descriptors.Descriptor
324 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPSolution_descriptor;
325 }
326
327 @java.lang.Override
329 return com.google.ortools.linearsolver.MPSolution.getDefaultInstance();
330 }
331
332 @java.lang.Override
335 if (!result.isInitialized()) {
336 throw newUninitializedMessageException(result);
337 }
338 return result;
339 }
340
341 @java.lang.Override
343 com.google.ortools.linearsolver.MPSolution result = new com.google.ortools.linearsolver.MPSolution(this);
344 if (bitField0_ != 0) { buildPartial0(result); }
345 onBuilt();
346 return result;
347 }
348
349 private void buildPartial0(com.google.ortools.linearsolver.MPSolution result) {
350 int from_bitField0_ = bitField0_;
351 int to_bitField0_ = 0;
352 if (((from_bitField0_ & 0x00000001) != 0)) {
353 result.objectiveValue_ = objectiveValue_;
354 to_bitField0_ |= 0x00000001;
355 }
356 if (((from_bitField0_ & 0x00000002) != 0)) {
357 variableValue_.makeImmutable();
358 result.variableValue_ = variableValue_;
359 }
360 result.bitField0_ |= to_bitField0_;
361 }
362
363 @java.lang.Override
364 public Builder clone() {
365 return super.clone();
366 }
367 @java.lang.Override
369 com.google.protobuf.Descriptors.FieldDescriptor field,
370 java.lang.Object value) {
371 return super.setField(field, value);
372 }
373 @java.lang.Override
375 com.google.protobuf.Descriptors.FieldDescriptor field) {
376 return super.clearField(field);
377 }
378 @java.lang.Override
380 com.google.protobuf.Descriptors.OneofDescriptor oneof) {
381 return super.clearOneof(oneof);
382 }
383 @java.lang.Override
385 com.google.protobuf.Descriptors.FieldDescriptor field,
386 int index, java.lang.Object value) {
387 return super.setRepeatedField(field, index, value);
388 }
389 @java.lang.Override
391 com.google.protobuf.Descriptors.FieldDescriptor field,
392 java.lang.Object value) {
393 return super.addRepeatedField(field, value);
394 }
395 @java.lang.Override
396 public Builder mergeFrom(com.google.protobuf.Message other) {
397 if (other instanceof com.google.ortools.linearsolver.MPSolution) {
398 return mergeFrom((com.google.ortools.linearsolver.MPSolution)other);
399 } else {
400 super.mergeFrom(other);
401 return this;
402 }
403 }
404
405 public Builder mergeFrom(com.google.ortools.linearsolver.MPSolution other) {
406 if (other == com.google.ortools.linearsolver.MPSolution.getDefaultInstance()) return this;
407 if (other.hasObjectiveValue()) {
408 setObjectiveValue(other.getObjectiveValue());
409 }
410 if (!other.variableValue_.isEmpty()) {
411 if (variableValue_.isEmpty()) {
412 variableValue_ = other.variableValue_;
413 variableValue_.makeImmutable();
414 bitField0_ |= 0x00000002;
415 } else {
416 ensureVariableValueIsMutable();
417 variableValue_.addAll(other.variableValue_);
418 }
419 onChanged();
420 }
421 this.mergeUnknownFields(other.getUnknownFields());
422 onChanged();
423 return this;
424 }
425
426 @java.lang.Override
427 public final boolean isInitialized() {
428 return true;
429 }
430
431 @java.lang.Override
433 com.google.protobuf.CodedInputStream input,
434 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
435 throws java.io.IOException {
436 if (extensionRegistry == null) {
437 throw new java.lang.NullPointerException();
438 }
439 try {
440 boolean done = false;
441 while (!done) {
442 int tag = input.readTag();
443 switch (tag) {
444 case 0:
445 done = true;
446 break;
447 case 9: {
448 objectiveValue_ = input.readDouble();
449 bitField0_ |= 0x00000001;
450 break;
451 } // case 9
452 case 17: {
453 double v = input.readDouble();
454 ensureVariableValueIsMutable();
455 variableValue_.addDouble(v);
456 break;
457 } // case 17
458 case 18: {
459 int length = input.readRawVarint32();
460 int limit = input.pushLimit(length);
461 int alloc = length > 4096 ? 4096 : length;
462 ensureVariableValueIsMutable(alloc / 8);
463 while (input.getBytesUntilLimit() > 0) {
464 variableValue_.addDouble(input.readDouble());
465 }
466 input.popLimit(limit);
467 break;
468 } // case 18
469 default: {
470 if (!super.parseUnknownField(input, extensionRegistry, tag)) {
471 done = true; // was an endgroup tag
472 }
473 break;
474 } // default:
475 } // switch (tag)
476 } // while (!done)
477 } catch (com.google.protobuf.InvalidProtocolBufferException e) {
478 throw e.unwrapIOException();
479 } finally {
480 onChanged();
481 } // finally
482 return this;
483 }
484 private int bitField0_;
485
486 private double objectiveValue_ ;
491 @java.lang.Override
492 public boolean hasObjectiveValue() {
493 return ((bitField0_ & 0x00000001) != 0);
494 }
499 @java.lang.Override
500 public double getObjectiveValue() {
501 return objectiveValue_;
502 }
508 public Builder setObjectiveValue(double value) {
509
510 objectiveValue_ = value;
511 bitField0_ |= 0x00000001;
512 onChanged();
513 return this;
514 }
520 bitField0_ = (bitField0_ & ~0x00000001);
521 objectiveValue_ = 0D;
522 onChanged();
523 return this;
524 }
525
526 private com.google.protobuf.Internal.DoubleList variableValue_ = emptyDoubleList();
527 private void ensureVariableValueIsMutable() {
528 if (!variableValue_.isModifiable()) {
529 variableValue_ = makeMutableCopy(variableValue_);
530 }
531 bitField0_ |= 0x00000002;
532 }
533 private void ensureVariableValueIsMutable(int capacity) {
534 if (!variableValue_.isModifiable()) {
535 variableValue_ = makeMutableCopy(variableValue_, capacity);
536 }
537 bitField0_ |= 0x00000002;
538 }
543 public java.util.List<java.lang.Double>
545 variableValue_.makeImmutable();
546 return variableValue_;
547 }
553 return variableValue_.size();
554 }
560 public double getVariableValue(int index) {
561 return variableValue_.getDouble(index);
562 }
570 int index, double value) {
571
572 ensureVariableValueIsMutable();
573 variableValue_.setDouble(index, value);
574 bitField0_ |= 0x00000002;
575 onChanged();
576 return this;
577 }
583 public Builder addVariableValue(double value) {
584
585 ensureVariableValueIsMutable();
586 variableValue_.addDouble(value);
587 bitField0_ |= 0x00000002;
588 onChanged();
589 return this;
590 }
597 java.lang.Iterable<? extends java.lang.Double> values) {
598 ensureVariableValueIsMutable();
599 com.google.protobuf.AbstractMessageLite.Builder.addAll(
600 values, variableValue_);
601 bitField0_ |= 0x00000002;
602 onChanged();
603 return this;
604 }
610 variableValue_ = emptyDoubleList();
611 bitField0_ = (bitField0_ & ~0x00000002);
612 onChanged();
613 return this;
614 }
615 @java.lang.Override
617 final com.google.protobuf.UnknownFieldSet unknownFields) {
618 return super.setUnknownFields(unknownFields);
619 }
620
621 @java.lang.Override
623 final com.google.protobuf.UnknownFieldSet unknownFields) {
624 return super.mergeUnknownFields(unknownFields);
625 }
626
627
628 // @@protoc_insertion_point(builder_scope:operations_research.MPSolution)
629 }
630
631 // @@protoc_insertion_point(class_scope:operations_research.MPSolution)
632 private static final com.google.ortools.linearsolver.MPSolution DEFAULT_INSTANCE;
633 static {
634 DEFAULT_INSTANCE = new com.google.ortools.linearsolver.MPSolution();
635 }
636
638 return DEFAULT_INSTANCE;
639 }
640
641 @java.lang.Deprecated public static final com.google.protobuf.Parser<MPSolution>
642 PARSER = new com.google.protobuf.AbstractParser<MPSolution>() {
643 @java.lang.Override
644 public MPSolution parsePartialFrom(
645 com.google.protobuf.CodedInputStream input,
646 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
647 throws com.google.protobuf.InvalidProtocolBufferException {
648 Builder builder = newBuilder();
649 try {
650 builder.mergeFrom(input, extensionRegistry);
651 } catch (com.google.protobuf.InvalidProtocolBufferException e) {
652 throw e.setUnfinishedMessage(builder.buildPartial());
653 } catch (com.google.protobuf.UninitializedMessageException e) {
654 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
655 } catch (java.io.IOException e) {
656 throw new com.google.protobuf.InvalidProtocolBufferException(e)
657 .setUnfinishedMessage(builder.buildPartial());
658 }
659 return builder.buildPartial();
660 }
661 };
662
663 public static com.google.protobuf.Parser<MPSolution> parser() {
664 return PARSER;
665 }
666
667 @java.lang.Override
668 public com.google.protobuf.Parser<MPSolution> getParserForType() {
669 return PARSER;
670 }
671
672 @java.lang.Override
674 return DEFAULT_INSTANCE;
675 }
676
677}
678
com.google.ortools.linearsolver.MPSolution getDefaultInstanceForType()
com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
Builder addAllVariableValue(java.lang.Iterable<? extends java.lang.Double > values)
com.google.ortools.linearsolver.MPSolution build()
Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)
Builder mergeFrom(com.google.protobuf.Message other)
Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)
java.util.List< java.lang.Double > getVariableValueList()
final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)
com.google.ortools.linearsolver.MPSolution buildPartial()
Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)
Builder mergeFrom(com.google.ortools.linearsolver.MPSolution other)
static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field)
final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)
Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)
Builder setVariableValue(int index, double value)
static com.google.ortools.linearsolver.MPSolution parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
static com.google.ortools.linearsolver.MPSolution parseFrom(java.nio.ByteBuffer data)
com.google.protobuf.Parser< MPSolution > getParserForType()
void writeTo(com.google.protobuf.CodedOutputStream output)
static com.google.ortools.linearsolver.MPSolution parseFrom(java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
static com.google.ortools.linearsolver.MPSolution getDefaultInstance()
static com.google.ortools.linearsolver.MPSolution parseFrom(com.google.protobuf.ByteString data)
static com.google.ortools.linearsolver.MPSolution parseDelimitedFrom(java.io.InputStream input)
static com.google.ortools.linearsolver.MPSolution parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
java.lang.Object newInstance(UnusedPrivateParameter unused)
boolean equals(final java.lang.Object obj)
static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
static com.google.protobuf.Parser< MPSolution > parser()
com.google.ortools.linearsolver.MPSolution getDefaultInstanceForType()
java.util.List< java.lang.Double > getVariableValueList()
static com.google.ortools.linearsolver.MPSolution parseFrom(java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
static final com.google.protobuf.Parser< MPSolution > PARSER
static com.google.ortools.linearsolver.MPSolution parseFrom(java.io.InputStream input)
static com.google.ortools.linearsolver.MPSolution parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
static Builder newBuilder(com.google.ortools.linearsolver.MPSolution prototype)
static com.google.ortools.linearsolver.MPSolution parseDelimitedFrom(java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
static com.google.ortools.linearsolver.MPSolution parseFrom(byte[] data)
Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
static com.google.ortools.linearsolver.MPSolution parseFrom(com.google.protobuf.CodedInputStream input)