1 | /*
|
---|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
|
---|
3 | * contributor license agreements. See the NOTICE file distributed with
|
---|
4 | * this work for additional information regarding copyright ownership.
|
---|
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
|
---|
6 | * (the "License"); you may not use this file except in compliance with
|
---|
7 | * the License. You may obtain a copy of the License at
|
---|
8 | *
|
---|
9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 | *
|
---|
11 | * Unless required by applicable law or agreed to in writing, software
|
---|
12 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
14 | * See the License for the specific language governing permissions and
|
---|
15 | * limitations under the License.
|
---|
16 | */
|
---|
17 |
|
---|
18 | package agents.anac.y2019.harddealer.math3.optim;
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * This interface specifies how to check if an optimization algorithm has
|
---|
22 | * converged.
|
---|
23 | * <br/>
|
---|
24 | * Deciding if convergence has been reached is a problem-dependent issue. The
|
---|
25 | * user should provide a class implementing this interface to allow the
|
---|
26 | * optimization algorithm to stop its search according to the problem at hand.
|
---|
27 | * <br/>
|
---|
28 | * For convenience, three implementations that fit simple needs are already
|
---|
29 | * provided: {@link SimpleValueChecker}, {@link SimpleVectorValueChecker} and
|
---|
30 | * {@link SimplePointChecker}. The first two consider that convergence is
|
---|
31 | * reached when the objective function value does not change much anymore, it
|
---|
32 | * does not use the point set at all.
|
---|
33 | * The third one considers that convergence is reached when the input point
|
---|
34 | * set does not change much anymore, it does not use objective function value
|
---|
35 | * at all.
|
---|
36 | *
|
---|
37 | * @param <PAIR> Type of the (point, objective value) pair.
|
---|
38 | *
|
---|
39 | * @see agents.anac.y2019.harddealer.math3.optim.SimplePointChecker
|
---|
40 | * @see agents.anac.y2019.harddealer.math3.optim.SimpleValueChecker
|
---|
41 | * @see agents.anac.y2019.harddealer.math3.optim.SimpleVectorValueChecker
|
---|
42 | *
|
---|
43 | * @since 3.0
|
---|
44 | */
|
---|
45 | public interface ConvergenceChecker<PAIR> {
|
---|
46 | /**
|
---|
47 | * Check if the optimization algorithm has converged.
|
---|
48 | *
|
---|
49 | * @param iteration Current iteration.
|
---|
50 | * @param previous Best point in the previous iteration.
|
---|
51 | * @param current Best point in the current iteration.
|
---|
52 | * @return {@code true} if the algorithm is considered to have converged.
|
---|
53 | */
|
---|
54 | boolean converged(int iteration, PAIR previous, PAIR current);
|
---|
55 | }
|
---|