001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    
018    package org.apache.commons.math.estimation;
019    
020    import java.io.Serializable;
021    
022    /** This class represents the estimated parameters of an estimation problem.
023     *
024     * <p>The parameters of an estimation problem have a name, a value and
025     * a bound flag. The value of bound parameters is considered trusted
026     * and the solvers should not adjust them. On the other hand, the
027     * solvers should adjust the value of unbounds parameters until they
028     * satisfy convergence criterions specific to each solver.</p>
029     *
030     * @version $Revision: 754732 $ $Date: 2009-03-15 15:30:44 -0400 (Sun, 15 Mar 2009) $
031     * @since 1.2
032     * @deprecated as of 2.0, everything in package org.apache.commons.math.estimation has
033     * been deprecated and replaced by package org.apache.commons.math.optimization.general
034     *
035     */
036    @Deprecated
037    public class EstimatedParameter
038      implements Serializable {
039    
040      /** Simple constructor.
041       * Build an instance from a first estimate of the parameter,
042       * initially considered unbound.
043       * @param name name of the parameter
044       * @param firstEstimate first estimate of the parameter
045       */
046      public EstimatedParameter(String name, double firstEstimate) {
047        this.name = name;
048        estimate  = firstEstimate;
049        bound     = false;
050      }
051    
052      /** Simple constructor.
053       * Build an instance from a first estimate of the parameter and a
054       * bound flag
055       * @param name name of the parameter
056       * @param firstEstimate first estimate of the parameter
057       * @param bound flag, should be true if the parameter is bound
058       */
059      public EstimatedParameter(String name,
060                                double firstEstimate,
061                                boolean bound) {
062        this.name  = name;
063        estimate   = firstEstimate;
064        this.bound = bound;
065      }
066    
067      /** Copy constructor.
068       * Build a copy of a parameter
069       * @param parameter instance to copy
070       */
071      public EstimatedParameter(EstimatedParameter parameter) {
072        name     = parameter.name;
073        estimate = parameter.estimate;
074        bound    = parameter.bound;
075      }
076    
077      /** Set a new estimated value for the parameter.
078       * @param estimate new estimate for the parameter
079       */
080      public void setEstimate(double estimate) {
081        this.estimate = estimate;
082      }
083    
084      /** Get the current estimate of the parameter
085       * @return current estimate
086       */
087      public double getEstimate() {
088        return estimate;
089      }
090    
091      /** get the name of the parameter
092       * @return parameter name
093       */
094      public String getName() {
095        return name;
096      }
097    
098      /** Set the bound flag of the parameter
099       * @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    }