9 package com.google.ortools.algorithms;
12 private transient long swigCPtr;
21 return (obj ==
null) ? 0 : obj.swigCPtr;
28 public synchronized void delete() {
32 mainJNI.delete_KnapsackSolver(swigCPtr);
39 this(mainJNI.new_KnapsackSolver__SWIG_0(solver_name),
true);
43 this(mainJNI.new_KnapsackSolver__SWIG_1(solver_type.swigValue(), solver_name),
true);
46 public void init(
long[] profits,
long[][] weights,
long[] capacities) {
47 mainJNI.KnapsackSolver_init(swigCPtr,
this, profits, weights, capacities);
51 return mainJNI.KnapsackSolver_solve(swigCPtr,
this);
55 return mainJNI.KnapsackSolver_bestSolutionContains(swigCPtr,
this, item_id);
59 return mainJNI.KnapsackSolver_isSolutionOptimal(swigCPtr,
this);
63 return mainJNI.KnapsackSolver_getName(swigCPtr,
this);
67 return mainJNI.KnapsackSolver_useReduction(swigCPtr,
this);
71 mainJNI.KnapsackSolver_setUseReduction(swigCPtr,
this, use_reduction);
75 mainJNI.KnapsackSolver_setTimeLimit(swigCPtr,
this, time_limit_seconds);
91 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
92 return swigValues[swigValue];
94 if (swigEnum.swigValue == swigValue)
96 throw new IllegalArgumentException(
"No enum " +
SolverType.class +
" with value " + swigValue);
99 @SuppressWarnings(
"unused")
101 this.swigValue = SwigNext.next++;
104 @SuppressWarnings(
"unused")
105 private SolverType(
int swigValue) {
106 this.swigValue = swigValue;
107 SwigNext.next = swigValue+1;
110 @SuppressWarnings(
"unused")
111 private SolverType(SolverType swigEnum) {
112 this.swigValue = swigEnum.swigValue;
113 SwigNext.next = this.swigValue+1;
116 private final int swigValue;
118 private static class SwigNext {
119 private static int next = 0;