9 package com.google.ortools.algorithms;
12 private transient long swigCPtr;
21 return (obj ==
null) ? 0 : obj.swigCPtr;
24 @SuppressWarnings(
"deprecation")
29 public synchronized void delete() {
33 mainJNI.delete_KnapsackSolver(swigCPtr);
40 this(mainJNI.new_KnapsackSolver__SWIG_0(solver_name),
true);
44 this(mainJNI.new_KnapsackSolver__SWIG_1(solver_type.swigValue(), solver_name),
true);
47 public void init(
long[] profits,
long[][] weights,
long[] capacities) {
48 mainJNI.KnapsackSolver_init(swigCPtr,
this, profits, weights, capacities);
52 return mainJNI.KnapsackSolver_solve(swigCPtr,
this);
56 return mainJNI.KnapsackSolver_bestSolutionContains(swigCPtr,
this, item_id);
60 return mainJNI.KnapsackSolver_isSolutionOptimal(swigCPtr,
this);
64 return mainJNI.KnapsackSolver_getName(swigCPtr,
this);
68 return mainJNI.KnapsackSolver_useReduction(swigCPtr,
this);
72 mainJNI.KnapsackSolver_setUseReduction(swigCPtr,
this, use_reduction);
76 mainJNI.KnapsackSolver_setTimeLimit(swigCPtr,
this, time_limit_seconds);
92 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
93 return swigValues[swigValue];
95 if (swigEnum.swigValue == swigValue)
97 throw new IllegalArgumentException(
"No enum " +
SolverType.class +
" with value " + swigValue);
100 @SuppressWarnings(
"unused")
102 this.swigValue = SwigNext.next++;
105 @SuppressWarnings(
"unused")
106 private SolverType(
int swigValue) {
107 this.swigValue = swigValue;
108 SwigNext.next = swigValue+1;
111 @SuppressWarnings(
"unused")
112 private SolverType(SolverType swigEnum) {
113 this.swigValue = swigEnum.swigValue;
114 SwigNext.next = this.swigValue+1;
117 private final int swigValue;
119 private static class SwigNext {
120 private static int next = 0;