Google OR-Tools v9.14
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// NO CHECKED-IN PROTOBUF GENCODE
3// source: ortools/linear_solver/linear_solver.proto
4// Protobuf Java Version: 4.31.1
5
6package com.google.ortools.linearsolver;
7
11@com.google.protobuf.Generated
12public final class MPSolution extends
13 com.google.protobuf.GeneratedMessage implements
14 // @@protoc_insertion_point(message_implements:operations_research.MPSolution)
16private static final long serialVersionUID = 0L;
17 static {
18 com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
19 com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
20 /* major= */ 4,
21 /* minor= */ 31,
22 /* patch= */ 1,
23 /* suffix= */ "",
24 MPSolution.class.getName());
25 }
26 // Use MPSolution.newBuilder() to construct.
27 private MPSolution(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
28 super(builder);
29 }
30 private MPSolution() {
31 variableValue_ = emptyDoubleList();
32 }
33
34 public static final com.google.protobuf.Descriptors.Descriptor
36 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPSolution_descriptor;
37 }
38
39 @java.lang.Override
40 protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
42 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPSolution_fieldAccessorTable
43 .ensureFieldAccessorsInitialized(
44 com.google.ortools.linearsolver.MPSolution.class, com.google.ortools.linearsolver.MPSolution.Builder.class);
45 }
46
47 private int bitField0_;
48 public static final int OBJECTIVE_VALUE_FIELD_NUMBER = 1;
49 private double objectiveValue_ = 0D;
54 @java.lang.Override
55 public boolean hasObjectiveValue() {
56 return ((bitField0_ & 0x00000001) != 0);
57 }
58
62 @java.lang.Override
63 public double getObjectiveValue() {
64 return objectiveValue_;
65 }
66
67 public static final int VARIABLE_VALUE_FIELD_NUMBER = 2;
68 @SuppressWarnings("serial")
69 private com.google.protobuf.Internal.DoubleList variableValue_ =
70 emptyDoubleList();
75 @java.lang.Override
76 public java.util.List<java.lang.Double>
78 return variableValue_;
79 }
80
84 public int getVariableValueCount() {
85 return variableValue_.size();
86 }
87
92 public double getVariableValue(int index) {
93 return variableValue_.getDouble(index);
94 }
95 private int variableValueMemoizedSerializedSize = -1;
96
97 private byte memoizedIsInitialized = -1;
98 @java.lang.Override
99 public final boolean isInitialized() {
100 byte isInitialized = memoizedIsInitialized;
101 if (isInitialized == 1) return true;
102 if (isInitialized == 0) return false;
103
104 memoizedIsInitialized = 1;
105 return true;
106 }
107
108 @java.lang.Override
109 public void writeTo(com.google.protobuf.CodedOutputStream output)
110 throws java.io.IOException {
112 if (((bitField0_ & 0x00000001) != 0)) {
113 output.writeDouble(1, objectiveValue_);
114 }
115 if (getVariableValueList().size() > 0) {
116 output.writeUInt32NoTag(18);
117 output.writeUInt32NoTag(variableValueMemoizedSerializedSize);
118 }
119 for (int i = 0; i < variableValue_.size(); i++) {
120 output.writeDoubleNoTag(variableValue_.getDouble(i));
121 }
122 getUnknownFields().writeTo(output);
123 }
124
125 @java.lang.Override
126 public int getSerializedSize() {
127 int size = memoizedSize;
128 if (size != -1) return size;
129
130 size = 0;
131 if (((bitField0_ & 0x00000001) != 0)) {
132 size += com.google.protobuf.CodedOutputStream
133 .computeDoubleSize(1, objectiveValue_);
134 }
135 {
136 int dataSize = 0;
137 dataSize = 8 * getVariableValueList().size();
138 size += dataSize;
139 if (!getVariableValueList().isEmpty()) {
140 size += 1;
141 size += com.google.protobuf.CodedOutputStream
142 .computeInt32SizeNoTag(dataSize);
143 }
144 variableValueMemoizedSerializedSize = dataSize;
145 }
146 size += getUnknownFields().getSerializedSize();
147 memoizedSize = size;
148 return size;
149 }
150
151 @java.lang.Override
152 public boolean equals(final java.lang.Object obj) {
153 if (obj == this) {
154 return true;
155 }
156 if (!(obj instanceof com.google.ortools.linearsolver.MPSolution)) {
157 return super.equals(obj);
158 }
159 com.google.ortools.linearsolver.MPSolution other = (com.google.ortools.linearsolver.MPSolution) obj;
160
161 if (hasObjectiveValue() != other.hasObjectiveValue()) return false;
162 if (hasObjectiveValue()) {
163 if (java.lang.Double.doubleToLongBits(getObjectiveValue())
164 != java.lang.Double.doubleToLongBits(
165 other.getObjectiveValue())) return false;
166 }
168 .equals(other.getVariableValueList())) return false;
169 if (!getUnknownFields().equals(other.getUnknownFields())) return false;
170 return true;
171 }
172
173 @java.lang.Override
174 public int hashCode() {
175 if (memoizedHashCode != 0) {
176 return memoizedHashCode;
177 }
178 int hash = 41;
179 hash = (19 * hash) + getDescriptor().hashCode();
180 if (hasObjectiveValue()) {
181 hash = (37 * hash) + OBJECTIVE_VALUE_FIELD_NUMBER;
182 hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
183 java.lang.Double.doubleToLongBits(getObjectiveValue()));
184 }
185 if (getVariableValueCount() > 0) {
186 hash = (37 * hash) + VARIABLE_VALUE_FIELD_NUMBER;
187 hash = (53 * hash) + getVariableValueList().hashCode();
188 }
189 hash = (29 * hash) + getUnknownFields().hashCode();
190 memoizedHashCode = hash;
191 return hash;
192 }
193
195 java.nio.ByteBuffer data)
196 throws com.google.protobuf.InvalidProtocolBufferException {
197 return PARSER.parseFrom(data);
198 }
200 java.nio.ByteBuffer data,
201 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
202 throws com.google.protobuf.InvalidProtocolBufferException {
203 return PARSER.parseFrom(data, extensionRegistry);
204 }
206 com.google.protobuf.ByteString data)
207 throws com.google.protobuf.InvalidProtocolBufferException {
208 return PARSER.parseFrom(data);
209 }
211 com.google.protobuf.ByteString data,
212 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
213 throws com.google.protobuf.InvalidProtocolBufferException {
214 return PARSER.parseFrom(data, extensionRegistry);
215 }
217 throws com.google.protobuf.InvalidProtocolBufferException {
218 return PARSER.parseFrom(data);
219 }
221 byte[] data,
222 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
223 throws com.google.protobuf.InvalidProtocolBufferException {
224 return PARSER.parseFrom(data, extensionRegistry);
225 }
226 public static com.google.ortools.linearsolver.MPSolution parseFrom(java.io.InputStream input)
227 throws java.io.IOException {
228 return com.google.protobuf.GeneratedMessage
229 .parseWithIOException(PARSER, input);
230 }
232 java.io.InputStream input,
233 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
234 throws java.io.IOException {
235 return com.google.protobuf.GeneratedMessage
236 .parseWithIOException(PARSER, input, extensionRegistry);
237 }
238
239 public static com.google.ortools.linearsolver.MPSolution parseDelimitedFrom(java.io.InputStream input)
240 throws java.io.IOException {
241 return com.google.protobuf.GeneratedMessage
242 .parseDelimitedWithIOException(PARSER, input);
243 }
244
246 java.io.InputStream input,
247 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
248 throws java.io.IOException {
249 return com.google.protobuf.GeneratedMessage
250 .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
251 }
253 com.google.protobuf.CodedInputStream input)
254 throws java.io.IOException {
255 return com.google.protobuf.GeneratedMessage
256 .parseWithIOException(PARSER, input);
257 }
259 com.google.protobuf.CodedInputStream input,
260 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
261 throws java.io.IOException {
262 return com.google.protobuf.GeneratedMessage
263 .parseWithIOException(PARSER, input, extensionRegistry);
264 }
265
266 @java.lang.Override
267 public Builder newBuilderForType() { return newBuilder(); }
268 public static Builder newBuilder() {
269 return DEFAULT_INSTANCE.toBuilder();
270 }
271 public static Builder newBuilder(com.google.ortools.linearsolver.MPSolution prototype) {
272 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
273 }
274 @java.lang.Override
276 return this == DEFAULT_INSTANCE
277 ? new Builder() : new Builder().mergeFrom(this);
278 }
279
280 @java.lang.Override
282 com.google.protobuf.GeneratedMessage.BuilderParent parent) {
283 Builder builder = new Builder(parent);
284 return builder;
285 }
286
289 public static final class Builder extends
290 com.google.protobuf.GeneratedMessage.Builder<Builder> implements
291 // @@protoc_insertion_point(builder_implements:operations_research.MPSolution)
293 public static final com.google.protobuf.Descriptors.Descriptor
295 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPSolution_descriptor;
296 }
297
298 @java.lang.Override
299 protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
301 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPSolution_fieldAccessorTable
302 .ensureFieldAccessorsInitialized(
303 com.google.ortools.linearsolver.MPSolution.class, com.google.ortools.linearsolver.MPSolution.Builder.class);
304 }
305
306 // Construct using com.google.ortools.linearsolver.MPSolution.newBuilder()
307 private Builder() {
308
309 }
310
311 private Builder(
312 com.google.protobuf.GeneratedMessage.BuilderParent parent) {
313 super(parent);
314
315 }
316 @java.lang.Override
317 public Builder clear() {
318 super.clear();
319 bitField0_ = 0;
320 objectiveValue_ = 0D;
321 variableValue_ = emptyDoubleList();
322 return this;
323 }
324
325 @java.lang.Override
326 public com.google.protobuf.Descriptors.Descriptor
328 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPSolution_descriptor;
329 }
330
331 @java.lang.Override
333 return com.google.ortools.linearsolver.MPSolution.getDefaultInstance();
334 }
335
336 @java.lang.Override
339 if (!result.isInitialized()) {
340 throw newUninitializedMessageException(result);
341 }
342 return result;
343 }
344
345 @java.lang.Override
347 com.google.ortools.linearsolver.MPSolution result = new com.google.ortools.linearsolver.MPSolution(this);
348 if (bitField0_ != 0) { buildPartial0(result); }
349 onBuilt();
350 return result;
351 }
352
353 private void buildPartial0(com.google.ortools.linearsolver.MPSolution result) {
354 int from_bitField0_ = bitField0_;
355 int to_bitField0_ = 0;
356 if (((from_bitField0_ & 0x00000001) != 0)) {
357 result.objectiveValue_ = objectiveValue_;
358 to_bitField0_ |= 0x00000001;
359 }
360 if (((from_bitField0_ & 0x00000002) != 0)) {
361 variableValue_.makeImmutable();
362 result.variableValue_ = variableValue_;
363 }
364 result.bitField0_ |= to_bitField0_;
365 }
366
367 @java.lang.Override
368 public Builder mergeFrom(com.google.protobuf.Message other) {
369 if (other instanceof com.google.ortools.linearsolver.MPSolution) {
370 return mergeFrom((com.google.ortools.linearsolver.MPSolution)other);
371 } else {
372 super.mergeFrom(other);
373 return this;
374 }
375 }
376
377 public Builder mergeFrom(com.google.ortools.linearsolver.MPSolution other) {
378 if (other == com.google.ortools.linearsolver.MPSolution.getDefaultInstance()) return this;
379 if (other.hasObjectiveValue()) {
380 setObjectiveValue(other.getObjectiveValue());
381 }
382 if (!other.variableValue_.isEmpty()) {
383 if (variableValue_.isEmpty()) {
384 variableValue_ = other.variableValue_;
385 variableValue_.makeImmutable();
386 bitField0_ |= 0x00000002;
387 } else {
388 ensureVariableValueIsMutable();
389 variableValue_.addAll(other.variableValue_);
390 }
391 onChanged();
392 }
393 this.mergeUnknownFields(other.getUnknownFields());
394 onChanged();
395 return this;
396 }
397
398 @java.lang.Override
399 public final boolean isInitialized() {
400 return true;
401 }
402
403 @java.lang.Override
404 public Builder mergeFrom(
405 com.google.protobuf.CodedInputStream input,
406 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
407 throws java.io.IOException {
408 if (extensionRegistry == null) {
409 throw new java.lang.NullPointerException();
410 }
411 try {
412 boolean done = false;
413 while (!done) {
414 int tag = input.readTag();
415 switch (tag) {
416 case 0:
417 done = true;
418 break;
419 case 9: {
420 objectiveValue_ = input.readDouble();
421 bitField0_ |= 0x00000001;
422 break;
423 } // case 9
424 case 17: {
425 double v = input.readDouble();
426 ensureVariableValueIsMutable();
427 variableValue_.addDouble(v);
428 break;
429 } // case 17
430 case 18: {
431 int length = input.readRawVarint32();
432 int limit = input.pushLimit(length);
433 int alloc = length > 4096 ? 4096 : length;
434 ensureVariableValueIsMutable(alloc / 8);
435 while (input.getBytesUntilLimit() > 0) {
436 variableValue_.addDouble(input.readDouble());
437 }
438 input.popLimit(limit);
439 break;
440 } // case 18
441 default: {
442 if (!super.parseUnknownField(input, extensionRegistry, tag)) {
443 done = true; // was an endgroup tag
444 }
445 break;
446 } // default:
447 } // switch (tag)
448 } // while (!done)
449 } catch (com.google.protobuf.InvalidProtocolBufferException e) {
450 throw e.unwrapIOException();
451 } finally {
452 onChanged();
453 } // finally
454 return this;
455 }
456 private int bitField0_;
457
458 private double objectiveValue_ ;
463 @java.lang.Override
464 public boolean hasObjectiveValue() {
465 return ((bitField0_ & 0x00000001) != 0);
466 }
467
471 @java.lang.Override
472 public double getObjectiveValue() {
473 return objectiveValue_;
474 }
475
480 public Builder setObjectiveValue(double value) {
481
482 objectiveValue_ = value;
483 bitField0_ |= 0x00000001;
484 onChanged();
485 return this;
486 }
487
491 public Builder clearObjectiveValue() {
492 bitField0_ = (bitField0_ & ~0x00000001);
493 objectiveValue_ = 0D;
494 onChanged();
495 return this;
496 }
497
498 private com.google.protobuf.Internal.DoubleList variableValue_ = emptyDoubleList();
499 private void ensureVariableValueIsMutable() {
500 if (!variableValue_.isModifiable()) {
501 variableValue_ = makeMutableCopy(variableValue_);
502 }
503 bitField0_ |= 0x00000002;
504 }
505 private void ensureVariableValueIsMutable(int capacity) {
506 if (!variableValue_.isModifiable()) {
507 variableValue_ = makeMutableCopy(variableValue_, capacity);
508 }
509 bitField0_ |= 0x00000002;
510 }
515 public java.util.List<java.lang.Double>
517 variableValue_.makeImmutable();
518 return variableValue_;
519 }
520
525 return variableValue_.size();
526 }
527
532 public double getVariableValue(int index) {
533 return variableValue_.getDouble(index);
534 }
535
541 public Builder setVariableValue(
542 int index, double value) {
543
544 ensureVariableValueIsMutable();
545 variableValue_.setDouble(index, value);
546 bitField0_ |= 0x00000002;
547 onChanged();
548 return this;
549 }
550
555 public Builder addVariableValue(double value) {
556
557 ensureVariableValueIsMutable();
558 variableValue_.addDouble(value);
559 bitField0_ |= 0x00000002;
560 onChanged();
561 return this;
562 }
563
568 public Builder addAllVariableValue(
569 java.lang.Iterable<? extends java.lang.Double> values) {
570 ensureVariableValueIsMutable();
571 com.google.protobuf.AbstractMessageLite.Builder.addAll(
572 values, variableValue_);
573 bitField0_ |= 0x00000002;
574 onChanged();
575 return this;
576 }
577
581 public Builder clearVariableValue() {
582 variableValue_ = emptyDoubleList();
583 bitField0_ = (bitField0_ & ~0x00000002);
584 onChanged();
585 return this;
586 }
587
588 // @@protoc_insertion_point(builder_scope:operations_research.MPSolution)
589 }
590
591 // @@protoc_insertion_point(class_scope:operations_research.MPSolution)
592 private static final com.google.ortools.linearsolver.MPSolution DEFAULT_INSTANCE;
593 static {
594 DEFAULT_INSTANCE = new com.google.ortools.linearsolver.MPSolution();
595 }
596
598 return DEFAULT_INSTANCE;
599 }
600
601 private static final com.google.protobuf.Parser<MPSolution>
602 PARSER = new com.google.protobuf.AbstractParser<MPSolution>() {
603 @java.lang.Override
604 public MPSolution parsePartialFrom(
605 com.google.protobuf.CodedInputStream input,
606 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
607 throws com.google.protobuf.InvalidProtocolBufferException {
608 Builder builder = newBuilder();
609 try {
610 builder.mergeFrom(input, extensionRegistry);
611 } catch (com.google.protobuf.InvalidProtocolBufferException e) {
612 throw e.setUnfinishedMessage(builder.buildPartial());
613 } catch (com.google.protobuf.UninitializedMessageException e) {
614 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
615 } catch (java.io.IOException e) {
616 throw new com.google.protobuf.InvalidProtocolBufferException(e)
617 .setUnfinishedMessage(builder.buildPartial());
618 }
619 return builder.buildPartial();
620 }
621 };
622
623 public static com.google.protobuf.Parser<MPSolution> parser() {
624 return PARSER;
625 }
626
627 @java.lang.Override
628 public com.google.protobuf.Parser<MPSolution> getParserForType() {
629 return PARSER;
630 }
631
632 @java.lang.Override
634 return DEFAULT_INSTANCE;
635 }
636
637}
638
com.google.ortools.linearsolver.MPSolution getDefaultInstanceForType()
com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
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 mergeFrom(com.google.protobuf.Message other)
java.util.List< java.lang.Double > getVariableValueList()
com.google.ortools.linearsolver.MPSolution buildPartial()
Builder mergeFrom(com.google.ortools.linearsolver.MPSolution other)
static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
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)
boolean equals(final java.lang.Object obj)
static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
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)
Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent)
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)
com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
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)
static com.google.ortools.linearsolver.MPSolution parseFrom(com.google.protobuf.CodedInputStream input)