View Javadoc

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 org.apache.commons.math.estimation;
19  
20  import java.io.Serializable;
21  
22  /** This class represents the estimated parameters of an estimation problem.
23   *
24   * <p>The parameters of an estimation problem have a name, a value and
25   * a bound flag. The value of bound parameters is considered trusted
26   * and the solvers should not adjust them. On the other hand, the
27   * solvers should adjust the value of unbounds parameters until they
28   * satisfy convergence criterions specific to each solver.</p>
29   *
30   * @version $Revision: 754732 $ $Date: 2009-03-15 15:30:44 -0400 (Sun, 15 Mar 2009) $
31   * @since 1.2
32   * @deprecated as of 2.0, everything in package org.apache.commons.math.estimation has
33   * been deprecated and replaced by package org.apache.commons.math.optimization.general
34   *
35   */
36  @Deprecated
37  public class EstimatedParameter
38    implements Serializable {
39  
40    /** Simple constructor.
41     * Build an instance from a first estimate of the parameter,
42     * initially considered unbound.
43     * @param name name of the parameter
44     * @param firstEstimate first estimate of the parameter
45     */
46    public EstimatedParameter(String name, double firstEstimate) {
47      this.name = name;
48      estimate  = firstEstimate;
49      bound     = false;
50    }
51  
52    /** Simple constructor.
53     * Build an instance from a first estimate of the parameter and a
54     * bound flag
55     * @param name name of the parameter
56     * @param firstEstimate first estimate of the parameter
57     * @param bound flag, should be true if the parameter is bound
58     */
59    public EstimatedParameter(String name,
60                              double firstEstimate,
61                              boolean bound) {
62      this.name  = name;
63      estimate   = firstEstimate;
64      this.bound = bound;
65    }
66  
67    /** Copy constructor.
68     * Build a copy of a parameter
69     * @param parameter instance to copy
70     */
71    public EstimatedParameter(EstimatedParameter parameter) {
72      name     = parameter.name;
73      estimate = parameter.estimate;
74      bound    = parameter.bound;
75    }
76  
77    /** Set a new estimated value for the parameter.
78     * @param estimate new estimate for the parameter
79     */
80    public void setEstimate(double estimate) {
81      this.estimate = estimate;
82    }
83  
84    /** Get the current estimate of the parameter
85     * @return current estimate
86     */
87    public double getEstimate() {
88      return estimate;
89    }
90  
91    /** get the name of the parameter
92     * @return parameter name
93     */
94    public String getName() {
95      return name;
96    }
97  
98    /** Set the bound flag of the parameter
99     * @param bound this flag should be set to true if the parameter is
100    * bound (i.e. if it should not be adjusted by the solver).
101    */
102   public void setBound(boolean bound) {
103     this.bound = bound;
104   }
105 
106   /** Check if the parameter is bound
107    * @return true if the parameter is bound */
108   public boolean isBound() {
109     return bound;
110   }
111 
112   /** Name of the parameter */
113   private   String  name;
114 
115   /** Current value of the parameter */
116   protected double  estimate;
117 
118   /** Indicator for bound parameters
119    * (ie parameters that should not be estimated)
120    */
121   private   boolean bound;
122 
123   /** Serializable version identifier */
124   private static final long serialVersionUID = -555440800213416949L;
125 
126 }