Class KnapsackProblem
java.lang.Object
com.knezevic.edaf.v3.problems.discrete.KnapsackProblem
-
Constructor Summary
ConstructorsConstructorDescriptionKnapsackProblem(int[] weights, int[] values, int capacity, double penaltyPerUnit) -
Method Summary
Modifier and TypeMethodDescriptionintcapacity()Evaluates one genotype and returns its fitness.intname()Problem identifier used for reporting and persistence.Returns whether this problem is min or max.violations(BitString genotype) Returns validation/constraint violations for diagnostics.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.knezevic.edaf.v3.core.api.Problem
feasible, objectiveCount
-
Constructor Details
-
KnapsackProblem
public KnapsackProblem(int[] weights, int[] values, int capacity, double penaltyPerUnit)
-
-
Method Details
-
name
-
objectiveSense
Description copied from interface:ProblemReturns whether this problem is min or max.- Specified by:
objectiveSensein interfaceProblem<BitString>
-
evaluate
-
violations
-
itemCount
public int itemCount() -
capacity
public int capacity()
-