Package de.mh4j.examples.maxknapsack.model

Examples of de.mh4j.examples.maxknapsack.model.Knapsack.addItem()


        "Awe", 30, 10)));

    SimulatedAnnealingKnapsackSolver solver = new SimulatedAnnealingKnapsackSolver(
        knapsackCapacity, items);
    Knapsack currentSolution = new Knapsack(knapsackCapacity);
    currentSolution.addItem(items.get(3));
    currentSolution.addItem(items.get(2));
    currentSolution.addItem(items.get(1));

    solver.setInitialSolution(currentSolution);
    solver.setLogLevel(Level.TRACE);
View Full Code Here


    SimulatedAnnealingKnapsackSolver solver = new SimulatedAnnealingKnapsackSolver(
        knapsackCapacity, items);
    Knapsack currentSolution = new Knapsack(knapsackCapacity);
    currentSolution.addItem(items.get(3));
    currentSolution.addItem(items.get(2));
    currentSolution.addItem(items.get(1));

    solver.setInitialSolution(currentSolution);
    solver.setLogLevel(Level.TRACE);
View Full Code Here

    SimulatedAnnealingKnapsackSolver solver = new SimulatedAnnealingKnapsackSolver(
        knapsackCapacity, items);
    Knapsack currentSolution = new Knapsack(knapsackCapacity);
    currentSolution.addItem(items.get(3));
    currentSolution.addItem(items.get(2));
    currentSolution.addItem(items.get(1));

    solver.setInitialSolution(currentSolution);
    solver.setLogLevel(Level.TRACE);

    boolean hasChanged = false;
View Full Code Here

        Knapsack knapsack = new Knapsack(knapsackCapacity);

        boolean itemHasBeenAdded;
        do {
            Item randomItem = Util.getRandomEntryFrom(availableItems);
            itemHasBeenAdded = knapsack.addItem(randomItem);
            availableItems.remove(randomItem);
        } while (itemHasBeenAdded && (availableItems.size() > 0));

        return knapsack;
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.