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