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