All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jamesframework.core.search.algo.exh.SolutionIterator Maven / Gradle / Ivy

Go to download

The James core module is part of the James framework for optimization using local search metaheuristics in Java. The core contains general components to model problems, objectives and constraints, as well as generic algorithms to solve the problems. Moreover, the core provides implementations of specific utilities for subset selection.

There is a newer version: 1.2
Show newest version
//  Copyright 2014 Herman De Beukelaer
//
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.

package org.jamesframework.core.search.algo.exh;

import java.util.NoSuchElementException;
import org.jamesframework.core.problems.solutions.Solution;

/**
 * Interface of a generic solution iterator that iterates through a collection of solutions.
 * The exhaustive search algorithm depends on solution iterators to evaluate all possible solutions. To use
 * this algorithm for a specific problem, a solution iterator has to be created first, which traverses the entire
 * solution space corresponding to this problem.
 * 
 * @param  solution type of generated solutions, required to extends {@link Solution}
 * @author Herman De Beukelaer
 */
public interface SolutionIterator {
    
    /**
     * Indicates whether there are more solutions to be generated.
     * 
     * @return true if solutions remain to be generated
     */
    public boolean hasNext();
    
    /**
     * Generate the next solution. This method should only be called when {@link #hasNext()} returns true,
     * else it will throw an exception.
     * 
     * @throws NoSuchElementException if there are no more solutions to be generated (see {@link #hasNext()})
     * @return next solution
     */
    public SolutionType next();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy