ADMB Documentation  11.1.1922
 All Classes Files Functions Variables Typedefs Friends Defines
df1b2fnl.h
Go to the documentation of this file.
00001 /*
00002  * $Id: df1b2fnl.h 1919 2014-04-22 22:02:01Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  *
00007  * ADModelbuilder and associated libraries and documentations are
00008  * provided under the general terms of the "BSD" license.
00009  *
00010  * License:
00011  *
00012  * Redistribution and use in source and binary forms, with or without
00013  * modification, are permitted provided that the following conditions are
00014  * met:
00015  *
00016  * 1. Redistributions of source code must retain the above copyright
00017  * notice, this list of conditions and the following disclaimer.
00018  *
00019  * 2.  Redistributions in binary form must reproduce the above copyright
00020  * notice, this list of conditions and the following disclaimer in the
00021  * documentation and/or other materials provided with the distribution.
00022  *
00023  * 3.  Neither the name of the  University of California, Otter Research,
00024  * nor the ADMB Foundation nor the names of its contributors may be used
00025  * to endorse or promote products derived from this software without
00026  * specific prior written permission.
00027  *
00028  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00029  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00030  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00031  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00032  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00033  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00034  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00035  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00036  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00037  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00038  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00039  *
00040  */
00046 #include <df1b2fun.h>
00047 #if !defined(__DF1B2FNL__)
00048 #  define __DF1B2FNL__
00049 #include <adrndeff.h>
00050 
00055 class funnel_init_var
00056 {
00057 public:
00058   static laplace_approximation_calculator * lapprox;
00059   static df1b2variable * funnel_constraints_penalty;
00060   static void reset_counters(void) { num_vars=0; /*num_all_vars=0;*/}
00061   static int num_vars;
00062   //static int num_all_vars;
00063   static int num_inactive_vars;
00064   static int num_active_parameters;
00065   static init_df1b2vector * py;
00066   static imatrix * plist;
00067   int index;
00068   static   funnel_init_var ** list;
00069   //static   funnel_init_var ** all_list;
00070   static   funnel_init_var ** inactive_list;
00071   funnel_init_var(void) { /*add_to_list();*/ }
00072   void add_to_list(void);
00073   void delete_from_list(void);
00074   void add_to_inactive_list(void);
00075   virtual void allocate(void);
00076   //virtual void xinit(void);
00077   virtual void xinit(init_df1b2vector&,int& ii)=0;
00078   virtual void xinit(dvector&,int& ii)=0;
00079   virtual void set_value(const init_df1b2vector&,const int& ii,
00080     const df1b2variable&)=0;
00081   virtual void set_value(const init_df1b2vector&,const int& ii)=0;
00082   virtual void set_index(imatrix&,int& ii)=0;
00083   virtual int nvar_calc(void)=0;
00084 
00085   static void reset(init_df1b2vector& x);
00086 
00087   static void allocate_all(void);
00088   static int nvarcalc_all(void);
00089 };
00090 
00095 class funnel_dependent_df1b2variable : public df1b2variable
00096 {
00097 public:
00098   double * get_u(void){ return df1b2variable::get_u();}
00099   void operator = (const df1b2variable&)
00100   {
00101     cerr << "Cannot assign to funnel_dependent_df1b2variable" << endl;
00102     ad_exit(1);
00103   }
00104   funnel_dependent_df1b2variable(const df1b2variable&);
00105   //virtual void allocate_all(init_df1b2vector&,int& ii);
00106 };
00107 
00112 class funnel_init_df1b2variable : public funnel_init_var, public df1b2variable
00113 {
00114 public:
00115   int type;
00116   void * pointer;
00117   double xu;
00118   int ind_index;
00119   int nvar_calc(void){return 1;}
00120   funnel_init_df1b2variable(const df1b2_init_number & x);
00121   funnel_init_df1b2variable(const funnel_init_df1b2variable& x);
00122   funnel_init_df1b2variable(const df1b2variable & x);
00123   funnel_init_df1b2variable(void);
00124   funnel_init_df1b2variable(const random_effects_bounded_vector_info&);
00125   virtual void allocate(void);
00126   virtual void allocate(const df1b2variable&);
00127   virtual void preallocate(const df1b2variable&);
00128   virtual void xinit(init_df1b2vector&,int& ii);
00129   virtual void xinit(dvector&,int& ii);
00130   virtual void set_value(const init_df1b2vector&,const int& ii);
00131   virtual void set_value(const init_df1b2vector&,const int& ii,
00132     const df1b2variable&);
00133   virtual void set_index(imatrix&,int& ii);
00134 };
00135 
00140 class funnel_init_bounded_df1b2vector : public funnel_init_var,
00141   public df1b2vector
00142 {
00143   const df1b2_init_bounded_vector * p;
00144 public:
00145   int nvar_calc(void);
00146   funnel_init_bounded_df1b2vector(const df1b2_init_bounded_vector & x);
00147   virtual void xinit(init_df1b2vector&,int& ii);
00148   virtual void xinit(dvector&, int&){ cout << "here"<< endl;}
00149   virtual void set_value(const init_df1b2vector&,const int& ii,
00150     const df1b2variable&);
00151   virtual void set_value(const init_df1b2vector&, const int&)
00152     { cout << "here"<< endl;}
00153   virtual void set_index(imatrix&,int& ii);
00154 };
00155 
00160 class funnel_init_df1b2vector : public funnel_init_var, public df1b2vector
00161 {
00162   const df1b2vector * p;
00163   //const df1b2_init_vector * p;
00164 public:
00165   int nvar_calc(void);
00166   //funnel_init_df1b2vector(const df1b2_init_vector & x);
00167   funnel_init_df1b2vector(const df1b2vector & x);
00168   virtual void xinit(init_df1b2vector&,int& ii);
00169   virtual void xinit(dvector&, int&){ cout << "here"<< endl;}
00170   virtual void set_value(const init_df1b2vector&,const int& ii,
00171     const df1b2variable&);
00172   virtual void set_value(const init_df1b2vector&, const int&)
00173     { cout << "here"<< endl;}
00174   virtual void set_index(imatrix&,int& ii);
00175   virtual void allocate(void);
00176 };
00177 
00182 class funnel_init_df1b2matrix : public funnel_init_var, public df1b2matrix
00183 {
00184   const df1b2matrix* p;
00185   //const df1b2_init_vector * p;
00186 public:
00187   int nvar_calc(void);
00188   //funnel_init_df1b2vector(const df1b2_init_vector & x);
00189   funnel_init_df1b2matrix(const df1b2matrix & x);
00190   virtual void xinit(init_df1b2vector&,int& ii);
00191   virtual void xinit(dvector&, int&){ cout << "here"<< endl;}
00192   virtual void set_value(const init_df1b2vector&,const int& ii,
00193     const df1b2variable&);
00194   virtual void set_value(const init_df1b2vector&, const int&)
00195     { cout << "here"<< endl;}
00196   virtual void set_index(imatrix&,int& ii);
00197 };
00198 #endif  //  #if !defined(__DF1B2FNL__)