9 package com.google.ortools.algorithms;
98 private transient long swigCPtr;
99 protected transient boolean swigCMemOwn;
102 swigCMemOwn = cMemoryOwn;
107 return (obj ==
null) ? 0 : obj.swigCPtr;
110 @SuppressWarnings(
"deprecation")
111 protected
void finalize() {
115 public synchronized void delete() {
119 mainJNI.delete_KnapsackSolver(swigCPtr);
126 this(mainJNI.new_KnapsackSolver__SWIG_0(solver_name),
true);
130 this(mainJNI.new_KnapsackSolver__SWIG_1(solver_type.swigValue(), solver_name),
true);
136 public void init(
long[] profits,
long[][] weights,
long[] capacities) {
137 mainJNI.KnapsackSolver_init(swigCPtr,
this, profits, weights, capacities);
144 return mainJNI.KnapsackSolver_solve(swigCPtr,
this);
151 return mainJNI.KnapsackSolver_bestSolutionContains(swigCPtr,
this, item_id);
158 return mainJNI.KnapsackSolver_isSolutionOptimal(swigCPtr,
this);
162 return mainJNI.KnapsackSolver_getName(swigCPtr,
this);
166 return mainJNI.KnapsackSolver_useReduction(swigCPtr,
this);
170 mainJNI.KnapsackSolver_setUseReduction(swigCPtr,
this, use_reduction);
180 mainJNI.KnapsackSolver_setTimeLimit(swigCPtr,
this, time_limit_seconds);
236 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
237 return swigValues[swigValue];
239 if (swigEnum.swigValue == swigValue)
241 throw new IllegalArgumentException(
"No enum " +
SolverType.class +
" with value " + swigValue);
244 @SuppressWarnings(
"unused")
246 this.swigValue = SwigNext.next++;
249 @SuppressWarnings(
"unused")
250 private SolverType(
int swigValue) {
251 this.swigValue = swigValue;
252 SwigNext.next = swigValue+1;
255 @SuppressWarnings(
"unused")
256 private SolverType(SolverType swigEnum) {
257 this.swigValue = swigEnum.swigValue;
258 SwigNext.next = this.swigValue+1;
261 private final int swigValue;
263 private static class SwigNext {
264 private static int next = 0;