Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
LinearSumAssignment.java
Go to the documentation of this file.
1/* ----------------------------------------------------------------------------
2 * This file was automatically generated by SWIG (https://www.swig.org).
3 * Version 4.2.1
4 *
5 * Do not make changes to this file unless you know what you are doing - modify
6 * the SWIG interface file instead.
7 * ----------------------------------------------------------------------------- */
8
9package com.google.ortools.graph;
10
11public class LinearSumAssignment {
12 private transient long swigCPtr;
13 protected transient boolean swigCMemOwn;
14
15 protected LinearSumAssignment(long cPtr, boolean cMemoryOwn) {
16 swigCMemOwn = cMemoryOwn;
17 swigCPtr = cPtr;
18 }
19
20 protected static long getCPtr(LinearSumAssignment obj) {
21 return (obj == null) ? 0 : obj.swigCPtr;
22 }
23
24 protected static long swigRelease(LinearSumAssignment obj) {
25 long ptr = 0;
26 if (obj != null) {
27 if (!obj.swigCMemOwn)
28 throw new RuntimeException("Cannot release ownership as memory is not owned");
29 ptr = obj.swigCPtr;
30 obj.swigCMemOwn = false;
31 obj.delete();
32 }
33 return ptr;
34 }
35
36 @SuppressWarnings({"deprecation", "removal"})
37 protected void finalize() {
38 delete();
39 }
40
41 public synchronized void delete() {
42 if (swigCPtr != 0) {
43 if (swigCMemOwn) {
44 swigCMemOwn = false;
45 mainJNI.delete_LinearSumAssignment(swigCPtr);
46 }
47 swigCPtr = 0;
48 }
49 }
50
52 this(mainJNI.new_LinearSumAssignment(), true);
53 }
54
55 public int addArcWithCost(int left_node, int right_node, long cost) {
56 return mainJNI.LinearSumAssignment_addArcWithCost(swigCPtr, this, left_node, right_node, cost);
57 }
58
59 public int getNumNodes() {
60 return mainJNI.LinearSumAssignment_getNumNodes(swigCPtr, this);
61 }
62
63 public int getNumArcs() {
64 return mainJNI.LinearSumAssignment_getNumArcs(swigCPtr, this);
65 }
66
67 public int getLeftNode(int arc) {
68 return mainJNI.LinearSumAssignment_getLeftNode(swigCPtr, this, arc);
69 }
70
71 public int getRightNode(int arc) {
72 return mainJNI.LinearSumAssignment_getRightNode(swigCPtr, this, arc);
73 }
74
75 public long getCost(int arc) {
76 return mainJNI.LinearSumAssignment_getCost(swigCPtr, this, arc);
77 }
78
79 public LinearSumAssignment.Status solve() {
80 return LinearSumAssignment.Status.swigToEnum(mainJNI.LinearSumAssignment_solve(swigCPtr, this));
81 }
82
83 public long getOptimalCost() {
84 return mainJNI.LinearSumAssignment_getOptimalCost(swigCPtr, this);
85 }
86
87 public int getRightMate(int left_node) {
88 return mainJNI.LinearSumAssignment_getRightMate(swigCPtr, this, left_node);
89 }
90
91 public long getAssignmentCost(int left_node) {
92 return mainJNI.LinearSumAssignment_getAssignmentCost(swigCPtr, this, left_node);
93 }
94
95 public enum Status {
99
100 public final int swigValue() {
101 return swigValue;
102 }
103
104 public static Status swigToEnum(int swigValue) {
105 Status[] swigValues = Status.class.getEnumConstants();
106 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
107 return swigValues[swigValue];
108 for (Status swigEnum : swigValues)
109 if (swigEnum.swigValue == swigValue)
110 return swigEnum;
111 throw new IllegalArgumentException("No enum " + Status.class + " with value " + swigValue);
112 }
113
114 @SuppressWarnings("unused")
115 private Status() {
116 this.swigValue = SwigNext.next++;
117 }
118
119 @SuppressWarnings("unused")
120 private Status(int swigValue) {
121 this.swigValue = swigValue;
122 SwigNext.next = swigValue+1;
123 }
124
125 @SuppressWarnings("unused")
126 private Status(Status swigEnum) {
127 this.swigValue = swigEnum.swigValue;
128 SwigNext.next = this.swigValue+1;
129 }
130
131 private final int swigValue;
132
133 private static class SwigNext {
134 private static int next = 0;
135 }
136 }
137
138}
static long getCPtr(LinearSumAssignment obj)
int addArcWithCost(int left_node, int right_node, long cost)
LinearSumAssignment(long cPtr, boolean cMemoryOwn)
static long swigRelease(LinearSumAssignment obj)