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: 922710 $ $Date: 2010-03-13 20:20:56 -0500 (Sat, 13 Mar 2010) $
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        /** Serializable version identifier */
041        private static final long serialVersionUID = -555440800213416949L;
042    
043        /** Current value of the parameter */
044        protected double  estimate;
045    
046        /** Name of the parameter */
047        private final String  name;
048    
049        /** Indicator for bound parameters
050         * (ie parameters that should not be estimated)
051         */
052        private   boolean bound;
053    
054        /** Simple constructor.
055         * Build an instance from a first estimate of the parameter,
056         * initially considered unbound.
057         * @param name name of the parameter
058         * @param firstEstimate first estimate of the parameter
059         */
060        public EstimatedParameter(String name, double firstEstimate) {
061            this.name = name;
062            estimate  = firstEstimate;
063            bound     = false;
064        }
065    
066        /** Simple constructor.
067         * Build an instance from a first estimate of the parameter and a
068         * bound flag
069         * @param name name of the parameter
070         * @param firstEstimate first estimate of the parameter
071         * @param bound flag, should be true if the parameter is bound
072         */
073        public EstimatedParameter(String name,
074                                  double firstEstimate,
075                                  boolean bound) {
076            this.name  = name;
077            estimate   = firstEstimate;
078            this.bound = bound;
079        }
080    
081        /** Copy constructor.
082         * Build a copy of a parameter
083         * @param parameter instance to copy
084         */
085        public EstimatedParameter(EstimatedParameter parameter) {
086            name     = parameter.name;
087            estimate = parameter.estimate;
088            bound    = parameter.bound;
089        }
090    
091        /** Set a new estimated value for the parameter.
092         * @param estimate new estimate for the parameter
093         */
094        public void setEstimate(double estimate) {
095            this.estimate = estimate;
096        }
097    
098        /** Get the current estimate of the parameter
099         * @return current estimate
100         */
101        public double getEstimate() {
102            return estimate;
103        }
104    
105        /** get the name of the parameter
106         * @return parameter name
107         */
108        public String getName() {
109            return name;
110        }
111    
112        /** Set the bound flag of the parameter
113         * @param bound this flag should be set to true if the parameter is
114         * bound (i.e. if it should not be adjusted by the solver).
115         */
116        public void setBound(boolean bound) {
117            this.bound = bound;
118        }
119    
120        /** Check if the parameter is bound
121         * @return true if the parameter is bound */
122        public boolean isBound() {
123            return bound;
124        }
125    
126    }