source: src/main/java/agents/anac/y2019/harddealer/math3/optimization/linear/LinearOptimizer.java

Last change on this file was 204, checked in by Katsuhide Fujita, 5 years ago

Fixed errors of ANAC2019 agents

  • Property svn:executable set to *
File size: 4.1 KB
Line 
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
18package agents.anac.y2019.harddealer.math3.optimization.linear;
19
20import java.util.Collection;
21
22import agents.anac.y2019.harddealer.math3.exception.MathIllegalStateException;
23import agents.anac.y2019.harddealer.math3.optimization.GoalType;
24import agents.anac.y2019.harddealer.math3.optimization.PointValuePair;
25
26/**
27 * This interface represents an optimization algorithm for linear problems.
28 * <p>Optimization algorithms find the input point set that either {@link GoalType
29 * maximize or minimize} an objective function. In the linear case the form of
30 * the function is restricted to
31 * <pre>
32 * c<sub>1</sub>x<sub>1</sub> + ... c<sub>n</sub>x<sub>n</sub> = v
33 * </pre>
34 * and there may be linear constraints too, of one of the forms:
35 * <ul>
36 * <li>c<sub>1</sub>x<sub>1</sub> + ... c<sub>n</sub>x<sub>n</sub> = v</li>
37 * <li>c<sub>1</sub>x<sub>1</sub> + ... c<sub>n</sub>x<sub>n</sub> &lt;= v</li>
38 * <li>c<sub>1</sub>x<sub>1</sub> + ... c<sub>n</sub>x<sub>n</sub> >= v</li>
39 * <li>l<sub>1</sub>x<sub>1</sub> + ... l<sub>n</sub>x<sub>n</sub> + l<sub>cst</sub> =
40 * r<sub>1</sub>x<sub>1</sub> + ... r<sub>n</sub>x<sub>n</sub> + r<sub>cst</sub></li>
41 * <li>l<sub>1</sub>x<sub>1</sub> + ... l<sub>n</sub>x<sub>n</sub> + l<sub>cst</sub> &lt;=
42 * r<sub>1</sub>x<sub>1</sub> + ... r<sub>n</sub>x<sub>n</sub> + r<sub>cst</sub></li>
43 * <li>l<sub>1</sub>x<sub>1</sub> + ... l<sub>n</sub>x<sub>n</sub> + l<sub>cst</sub> >=
44 * r<sub>1</sub>x<sub>1</sub> + ... r<sub>n</sub>x<sub>n</sub> + r<sub>cst</sub></li>
45 * </ul>
46 * where the c<sub>i</sub>, l<sub>i</sub> or r<sub>i</sub> are the coefficients of
47 * the constraints, the x<sub>i</sub> are the coordinates of the current point and
48 * v is the value of the constraint.
49 * </p>
50 * @deprecated As of 3.1 (to be removed in 4.0).
51 * @since 2.0
52 */
53@Deprecated
54public interface LinearOptimizer {
55
56 /**
57 * Set the maximal number of iterations of the algorithm.
58 * @param maxIterations maximal number of function calls
59 */
60 void setMaxIterations(int maxIterations);
61
62 /**
63 * Get the maximal number of iterations of the algorithm.
64 * @return maximal number of iterations
65 */
66 int getMaxIterations();
67
68 /**
69 * Get the number of iterations realized by the algorithm.
70 * <p>
71 * The number of evaluations corresponds to the last call to the
72 * {@link #optimize(LinearObjectiveFunction, Collection, GoalType, boolean) optimize}
73 * method. It is 0 if the method has not been called yet.
74 * </p>
75 * @return number of iterations
76 */
77 int getIterations();
78
79 /**
80 * Optimizes an objective function.
81 * @param f linear objective function
82 * @param constraints linear constraints
83 * @param goalType type of optimization goal: either {@link GoalType#MAXIMIZE} or {@link GoalType#MINIMIZE}
84 * @param restrictToNonNegative whether to restrict the variables to non-negative values
85 * @return point/value pair giving the optimal value for objective function
86 * @exception MathIllegalStateException if no solution fulfilling the constraints
87 * can be found in the allowed number of iterations
88 */
89 PointValuePair optimize(LinearObjectiveFunction f, Collection<LinearConstraint> constraints,
90 GoalType goalType, boolean restrictToNonNegative) throws MathIllegalStateException;
91
92}
Note: See TracBrowser for help on using the repository browser.