// Path: MetaHeuristics4Java-Examples/src/main/java/de/mh4j/examples/maxknapsack/model/Item.java
// public class Item {
// 
//     public final String name;
//     public final int price;
//     public final int volume;
// 
//     public Item(String name, int price, int volume) {
//         this.name = name;
//         this.price = price;
//         this.volume = volume;
//     }
// 
//     @Override
//     public boolean equals(Object otherObject) {
//         if (otherObject instanceof Item == false) {
//             return false;
//         }
//         Item otherItem = (Item) otherObject;
//         return otherItem.name == this.name && otherItem.price == this.price && otherItem.volume == this.volume;
//     }
// 
//     @Override
//     public String toString() {
//         return name;
//     }
// }
// 
// Path: MetaHeuristics4Java-Examples/src/main/java/de/mh4j/examples/maxknapsack/model/Knapsack.java
// public class Knapsack implements Solution<Knapsack> {
// 
//     private final int totalCapacity;
//     private final List<Item> items;
// 
//     private int remainingCapacity;
//     private int costs;
// 
//     public Knapsack(int capacity) {
//         totalCapacity = capacity;
//         remainingCapacity = totalCapacity;
//         items = new ArrayList<>();
//         costs = 0;
//     }
// 
//     public Knapsack(Knapsack original) {
//         this.totalCapacity = original.totalCapacity;
//         this.items = new ArrayList<>(original.items);
//         this.remainingCapacity = original.remainingCapacity;
//         this.costs = original.costs;
//     }
// 
//     @Override
//     public int getCosts() {
//         return costs;
//     }
// 
//     public int getCapacity() {
//         return totalCapacity;
//     }
// 
//     @Override
//     public boolean isBetterThan(Knapsack otherSolution) {
//         return otherSolution.getCosts() < costs;
//     }
// 
//     public boolean addItem(Item item) {
//         int newRemainingCapacity = remainingCapacity - item.volume;
// 
//         if (newRemainingCapacity >= 0) {
//             items.add(item);
//             remainingCapacity = newRemainingCapacity;
//             costs += item.price;
//         }
// 
//         return newRemainingCapacity >= 0;
//     }
// 
//     public int getNumberOfItems() {
//         return items.size();
//     }
// 
//     public int getRemainingCapacity() {
//         return remainingCapacity;
//     }
// 
//     public Item removeItem(int index) {
//         Item removedItem = items.remove(index);
//         costs -= removedItem.price;
//         remainingCapacity += removedItem.volume;
//         return removedItem;
//     }
// 
//     public boolean isFull() {
//         return remainingCapacity == 0;
//     }
// 
//     @Override
//     public boolean equals(Object otherObject) {
//         if (otherObject instanceof Knapsack == false) {
//             return false;
//         }
// 
//         Knapsack otherKnapsack = (Knapsack) otherObject;
//     
//         if (otherKnapsack.items.size() != this.items.size()) {
//         	return false;
//         }
//         
//         for (Item item : items) {
//             if (otherKnapsack.items.contains(item) == false) {
//                 return false;
//             }
//         }
//         
// 
//         return this.totalCapacity == otherKnapsack.totalCapacity;
//     }
// 
//     @Override
//     public String toString() {
//         return (totalCapacity - remainingCapacity) + "/" + totalCapacity + ": " + items + " " + costs;
//     }
// }


import static org.testng.AssertJUnit.assertTrue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.testng.annotations.Test;
import ch.qos.logback.classic.Level;
import de.mh4j.examples.maxknapsack.model.Item;
import de.mh4j.examples.maxknapsack.model.Knapsack;
package de.mh4j.examples.maxknapsack.solver;





public class SimulatedAnnealingKnapsackSolverTest {

	@Test
	public void testSolveSimpleInstance() {
		int knapsackCapacity = 59;
		List<Item> items = new ArrayList<>(Arrays.asList(new Item("Foo", 100,
				40), new Item("Bar", 80, 30), new Item("Muh", 5, 5), new Item(
				"Awe", 30, 10)));

		SimulatedAnnealingKnapsackSolver solver = new SimulatedAnnealingKnapsackSolver(
				knapsackCapacity, items);
		solver.run();
	}

	@Test
	public void testBuggyConfiguration() {
		int knapsackCapacity = 59;
		List<Item> items = new ArrayList<>(Arrays.asList(new Item("Foo", 100,
				40), new Item("Bar", 80, 30), new Item("Muh", 5, 5), new Item(
				"Awe", 30, 10)));

		SimulatedAnnealingKnapsackSolver solver = new SimulatedAnnealingKnapsackSolver(
				knapsackCapacity, items);
// Path: MetaHeuristics4Java-Examples/src/main/java/de/mh4j/examples/maxknapsack/model/Item.java
// public class Item {
// 
//     public final String name;
//     public final int price;
//     public final int volume;
// 
//     public Item(String name, int price, int volume) {
//         this.name = name;
//         this.price = price;
//         this.volume = volume;
//     }
// 
//     @Override
//     public boolean equals(Object otherObject) {
//         if (otherObject instanceof Item == false) {
//             return false;
//         }
//         Item otherItem = (Item) otherObject;
//         return otherItem.name == this.name && otherItem.price == this.price && otherItem.volume == this.volume;
//     }
// 
//     @Override
//     public String toString() {
//         return name;
//     }
// }
// 
// Path: MetaHeuristics4Java-Examples/src/main/java/de/mh4j/examples/maxknapsack/model/Knapsack.java
// public class Knapsack implements Solution<Knapsack> {
// 
//     private final int totalCapacity;
//     private final List<Item> items;
// 
//     private int remainingCapacity;
//     private int costs;
// 
//     public Knapsack(int capacity) {
//         totalCapacity = capacity;
//         remainingCapacity = totalCapacity;
//         items = new ArrayList<>();
//         costs = 0;
//     }
// 
//     public Knapsack(Knapsack original) {
//         this.totalCapacity = original.totalCapacity;
//         this.items = new ArrayList<>(original.items);
//         this.remainingCapacity = original.remainingCapacity;
//         this.costs = original.costs;
//     }
// 
//     @Override
//     public int getCosts() {
//         return costs;
//     }
// 
//     public int getCapacity() {
//         return totalCapacity;
//     }
// 
//     @Override
//     public boolean isBetterThan(Knapsack otherSolution) {
//         return otherSolution.getCosts() < costs;
//     }
// 
//     public boolean addItem(Item item) {
//         int newRemainingCapacity = remainingCapacity - item.volume;
// 
//         if (newRemainingCapacity >= 0) {
//             items.add(item);
//             remainingCapacity = newRemainingCapacity;
//             costs += item.price;
//         }
// 
//         return newRemainingCapacity >= 0;
//     }
// 
//     public int getNumberOfItems() {
//         return items.size();
//     }
// 
//     public int getRemainingCapacity() {
//         return remainingCapacity;
//     }
// 
//     public Item removeItem(int index) {
//         Item removedItem = items.remove(index);
//         costs -= removedItem.price;
//         remainingCapacity += removedItem.volume;
//         return removedItem;
//     }
// 
//     public boolean isFull() {
//         return remainingCapacity == 0;
//     }
// 
//     @Override
//     public boolean equals(Object otherObject) {
//         if (otherObject instanceof Knapsack == false) {
//             return false;
//         }
// 
//         Knapsack otherKnapsack = (Knapsack) otherObject;
//     
//         if (otherKnapsack.items.size() != this.items.size()) {
//         	return false;
//         }
//         
//         for (Item item : items) {
//             if (otherKnapsack.items.contains(item) == false) {
//                 return false;
//             }
//         }
//         
// 
//         return this.totalCapacity == otherKnapsack.totalCapacity;
//     }
// 
//     @Override
//     public String toString() {
//         return (totalCapacity - remainingCapacity) + "/" + totalCapacity + ": " + items + " " + costs;
//     }
// }


// Path: MetaHeuristics4Java-Examples/src/test/java/de/mh4j/examples/maxknapsack/solver/SimulatedAnnealingKnapsackSolverTest.java
import static org.testng.AssertJUnit.assertTrue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.testng.annotations.Test;
import ch.qos.logback.classic.Level;
import de.mh4j.examples.maxknapsack.model.Item;
import de.mh4j.examples.maxknapsack.model.Knapsack;

package de.mh4j.examples.maxknapsack.solver;





public class SimulatedAnnealingKnapsackSolverTest {

	@Test
	public void testSolveSimpleInstance() {
		int knapsackCapacity = 59;
		List<Item> items = new ArrayList<>(Arrays.asList(new Item("Foo", 100,
				40), new Item("Bar", 80, 30), new Item("Muh", 5, 5), new Item(
				"Awe", 30, 10)));

		SimulatedAnnealingKnapsackSolver solver = new SimulatedAnnealingKnapsackSolver(
				knapsackCapacity, items);
		solver.run();
	}

	@Test
	public void testBuggyConfiguration() {
		int knapsackCapacity = 59;
		List<Item> items = new ArrayList<>(Arrays.asList(new Item("Foo", 100,
				40), new Item("Bar", 80, 30), new Item("Muh", 5, 5), new Item(
				"Awe", 30, 10)));

		SimulatedAnnealingKnapsackSolver solver = new SimulatedAnnealingKnapsackSolver(
				knapsackCapacity, items);
		Knapsack currentSolution = new Knapsack(knapsackCapacity);