Virtual U.org
Get Personal Training on VU Today
    
Top shadow
 
 register/help
User Name:

Password:

Oenroll.h Source File
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Oenroll.h

Go to the documentation of this file.
00001 //Filename    : OEnroll.h
00002 //Description : EnrollRes Class Declaration
00003 //Owner       : Fred
00004 
00005 #ifndef __OEnroll_H
00006 #define __OEnroll_H
00007 
00008 // ES library header file
00009 // CU header file
00010 #include <GAMEDEF.H>                              // HISTORY_YEAR_COUNT
00011 #include <OSTUDENT.H>                             // MAX_STUDENT_LEVEL, ACADEMIC
00012 
00013 //----------- Define constants -------------//
00014 #define MAX_TALENT_PRIORITY_LEVEL 10.0f
00015 #define PRIORITY_LEVEL_COUNT      3               // interface related constant
00016 
00017 //----------- Define enum types -------------//
00018 enum {
00019     INSTITU_SEGMENT_COUNT = 7,
00020     PREFERECNE_COUNT = 20,
00021     NON_FINANCIAL_PREFERECNE_COUNT = 14,
00022     //FINANCIAL_PREFERECNE_COUNT = 3,           // = (20-14)/2          // see D129:147
00023     PREFERECNE_COUNT2 = 21,
00024     SCHOOL_CONTROL_COUNT = 2                        // PUBLIC & PRIVATE in opschool.h
00025 };
00026 
00027 enum {
00028     MAX_STUDENT_LEVEL_NO_SL1 = MAX_STUDENT_LEVEL - 1,
00029     STUDENT_SEGMENT_COUNT = 7,
00030     STUDENT_SUBSEGMENT_COUNT = 4,                   // equal to GENDER_ETHNIC_TYPE implicitly
00031 
00032     STUDENT_SEGMENT_ATHLETE = 3,                    // index to array
00033 };
00034 
00035 enum {
00036     MINORITY_GROUP_COUNT = 2,
00037 
00038     NON_MINORITY = 0,
00039     MINORITY,
00040 };
00041 
00042 enum {
00043     APP_YIELD_VAR_COUNT = 3,                        // numbers of applications/offers/matriculations
00044 
00045     APPS = 0, OFFERS, MATRICS,
00046 };
00047 
00048 #if(GAME_VERSION>=200)
00049 enum {
00050     ER_YIELD_RATE = 0 , ER_OFFERS_RATE, ER_PERCENT_MINORITY, ER_ACADEMIC,
00051     ER_EXTRACURRICULAR, ER_ATHLETICS, ER_CREDITS_DEMANDED, ER_CREDITS_PROVIDED,
00052 
00053     HISTORY_GRAPH_COUNT_SL25 = ER_ACADEMIC+1,       // 4 graphs only
00054     // 8 graphs
00055     HISTORY_GRAPH_COUNT_GENERAL = ER_CREDITS_PROVIDED+1,
00056 };
00057 #else
00058 enum {
00059     ER_YIELD_RATE = 0 , ER_OFFERS_RATE, ER_PERCENT_MINORITY, ER_ACADEMIC,
00060     ER_EXTRACURRICULAR, ER_ATHLETICS,
00061 
00062     HISTORY_GRAPH_COUNT_SL25 = ER_ACADEMIC+1,       // 4 graphs only
00063     HISTORY_GRAPH_COUNT_GENERAL = ER_ATHLETICS+1,   // 6 graphs
00064 };
00065 #endif
00066 
00067 // for radio button input
00068 enum {
00069     SET_LOW = 0,
00070     SET_MID,
00071     SET_HIGH,
00072 };
00073 
00074 //----------- Define struct -------------//
00075 
00076 // refer to HE.initialization[stu_pref]
00078 struct PreferenceRec {
00079     char  value[INSTITU_SEGMENT_COUNT][9];
00080     char  weight[9];
00081 };
00082 
00084 struct Preference {
00085     float average;
00086     float deviation;
00087     float weight;
00088     float tmp_fuzzy_value;
00089 };
00090 
00091 // refer to [HE.STU.pref]sheet1, struct for all student levels
00094 struct PreferenceRec2 {
00095     char  weight[4][9];
00096 };
00097 
00099 struct Preference2 {
00100     float apps_ratio, yield_rate;
00101 };
00102 
00103 // refer to [HE.initialization]Apps_Yield
00105 struct AppYieldRec {
00106     char  count[INSTITU_SEGMENT_COUNT][9];
00107 };
00108 
00109 // refer to [HE.STU.talent.xls]Sheet1
00112 struct TalentRec {
00113     char  seg[STUDENT_SEGMENT_COUNT][9];
00114 };
00115 
00118 struct Talent {
00119     float average;
00120     float variance;
00121 };
00122 
00123 //------- Define struct EnrollDataSL1 -----//
00125 struct EnrollData {
00126     float apps_ratio;                               //, yield_rate;
00127     int base_apps;
00128     float fraction_matrics;
00129 
00130     int applications;
00131     //int       offers;
00132     int matrics;
00133 
00134     float   student_pref;
00135     float   conversion_rate, base_conversion_rate;
00136     Talent  academic;
00137 };
00138 
00140 struct EnrollDataSL1 {                            //: public EnrollData
00141     float apps_ratio, yield_rate;
00142     int base_apps;
00143     float base_yield_rate, fraction_matrics;
00144 
00145     int applications;
00146     int offers;
00147     int matrics;
00148 
00149     float util, util_variance;
00150 };
00151 
00152 //----------- Define class EnrollRes -----//
00155 class EnrollRes {
00156     // arrays read from dbs for enrollment
00157 public:
00158     Preference  preference_array[PREFERECNE_COUNT][INSTITU_SEGMENT_COUNT];
00159     Preference2 preference_array2[SCHOOL_CONTROL_COUNT][MINORITY_GROUP_COUNT][PREFERECNE_COUNT2];
00160     short     app_yield_array[STUDENT_SUBSEGMENT_COUNT][STUDENT_SEGMENT_COUNT][INSTITU_SEGMENT_COUNT][APP_YIELD_VAR_COUNT];
00161     Talent    talent_array[STUDENT_SUBSEGMENT_COUNT][STUDENT_SEGMENT_COUNT][TALENT_INCOME_VAR_COUNT];
00162 
00163     //------------------------------------------//
00164 
00165 public:
00166     EnrollRes();
00167     void  init();
00168     void  deinit();
00169 
00170     int write_file(File* filePtr);
00171     int read_file(File* filePtr);
00172 
00173     void  init_data();
00174     void  enroll_main(int initFlag=0);
00175     void  next_day();
00176     void  update_history(char update_flag);
00177 
00178     //------------------------------------------//
00179 
00180 private:
00181     void  load_db_student_pref();
00182     void  load_db_student_pref2();
00183     void  load_db_student_talent();
00184     void  load_db_app_yield();
00185     void  update_income();
00186 
00187     //----------------------------------------------------//
00188     //-- data and methods for enrollment and other model -//
00189     //----------------------------------------------------//
00190 
00191 public:
00192 #if(GAME_VERSION>=200)
00193     // for interface on student turnover
00194     int   new_year_student_count[MAX_STUDENT_LEVEL];
00195     int last_year_student_count[MAX_STUDENT_LEVEL];
00196 #endif
00197     // updated per trimester:
00198     int total_student_count;
00199     int student_count[MAX_STUDENT_LEVEL];
00200     float student_female_percent[MAX_STUDENT_LEVEL];
00201     float student_minority_percent[MAX_STUDENT_LEVEL];
00202 #if(GAME_VERSION>=200)
00203     // for new formula of diversity
00204     float student_minority_female_percent[MAX_STUDENT_LEVEL];
00205 #endif
00206 
00207 public:
00208     void  calc_student_count(int initFlag=0);
00209     // 990427
00210     void  set_app_yield(float appMultipler, float yieldMultiplier);
00211 
00212     //----------------------------------------------------//
00213     //-- data and methods for PGI enrollment only               ---//
00214     //----------------------------------------------------//
00215 public:
00216     //----- for athletic office -----//
00217     int male_matrics_top_athletes;                // for all student level
00218     char  avg_athletic_talent_male_matrics;
00219     char  avg_athletic_talent_female_matrics;
00220 
00221     //----- for interface -----//
00222     int matrics_top_athletes;                     // for all student level
00223     float total_aid;                              // for all student level // ($000)
00224     int total_applications[MAX_STUDENT_LEVEL], total_offers[MAX_STUDENT_LEVEL], total_matrics[MAX_STUDENT_LEVEL];
00225 
00226     // rates in 0.999 for 99.9% format;  ug_applications_rate & ug_yield_rate defined in School will not be updated
00227     float applications_rate[MAX_STUDENT_LEVEL], cur_yield_rate[MAX_STUDENT_LEVEL];
00228     float offers_rate[MAX_STUDENT_LEVEL];
00229 
00230     int talent_average[MAX_STUDENT_LEVEL_N_TOTAL][TALENT_VAR_COUNT];
00231     //99 -> 99%
00232     float overall_yield_rate, overall_offers_rate, overall_apps_rate;
00233 
00234     // ##### Begin MArco ##### //
00235 #if(GAME_VERSION>=200)
00236     float initial_offers_rate[MAX_STUDENT_LEVEL];
00237     float initial_cur_yield_rate[MAX_STUDENT_LEVEL];
00238     int initial_matrics_top_athletes;
00239 #endif
00240     // ##### End MArco ##### //
00241 
00242     //----- intermediate vars -----//
00243 private:
00244     // adjusted to thousands of dollars
00245     float max_aid;
00246     float need_lower, need_upper;
00247     float merit_lower[MAX_STUDENT_LEVEL], merit_upper[MAX_STUDENT_LEVEL];
00248 
00249     float fraction_on_aid[MINORITY_GROUP_COUNT];
00250     int average_aid[MINORITY_GROUP_COUNT];
00251 
00252     // for storing result of calc_student_pref()
00253     float pref_weight_array[INSTITU_SEGMENT_COUNT];
00254 public:
00255     EnrollDataSL1 enroll_data_sl1[STUDENT_SUBSEGMENT_COUNT][STUDENT_SEGMENT_COUNT];
00256     EnrollData    enroll_data_sls[MAX_STUDENT_LEVEL_NO_SL1][STUDENT_SUBSEGMENT_COUNT];
00257 
00258 private:
00259 
00260     //----- constants -----//
00261 
00262     static const float  yield_latency[MAX_STUDENT_LEVEL];
00263     static const float  apps_latency[MAX_STUDENT_LEVEL];
00264     static const float  aidMinMultipliers[PRIORITY_LEVEL_COUNT];
00265 
00266     //-------- define constants for the calc_applications and matriculations ----------//
00267     // s-function parameters from R33:35 in HE.STU.pref.xls
00268     float s_lower_bound;
00269     float s_upper_bound;
00270     float s_slope;
00271 
00272     // see R31 in HE.STU.pref.xls
00273     bool  pref_special_case(int x)  { return ( x==5 || x==7 || x==9 || x==15 || x==16 );  };
00274 
00275     float chance_avg;
00276     float chance_sd;
00277     float fraction_merit_top;
00278 
00279 private:
00280     void  init_data_sl1();
00281     void  calc_talent_student_db();
00282     void  calc_student_pref();                    // for init_data_sl1
00283     void  calc_app_yield();                       // for init_data_sl1
00284 
00285 public:
00286     void  calc_enroll_applications();
00287     void  calc_enroll_offers();
00288     void  calc_enroll_matriculations();
00289 private:
00290     void  calc_post_enroll();
00291     void  calc_total_aid();
00292     void  calc_post_enroll_adjust_aid_all_sls();
00293 public:
00294     void  update_enroll_history(char noshift=0);
00295 
00296     float calc_an_aid(Student *stuPtr);
00297     void  calc_a_talent(float talentArr[TALENT_VAR_COUNT], char sl, char subSeg, char seg=0);
00298 
00299     // ##### begin Marco ##### //
00300 #if(GAME_VERSION>=200)
00301     void save_initial_data();
00302 #endif
00303     // ##### End Marco ##### //
00304 
00305     //----------------------------------------------------//
00306     //-- data and methods for PGI enrollment sl2-5              ---//
00307     //----------------------------------------------------//
00308 
00309     //intermediate vars
00310 private:
00311     // a array read from db
00312 #if(GAME_VERSION>=200)
00313     float preference_array2_sls[MAX_STUDENT_LEVEL_NO_SL1][SCHOOL_CONTROL_COUNT][MINORITY_GROUP_COUNT][PREFERECNE_COUNT2+1];
00314 #else
00315     float preference_array2_sls[MAX_STUDENT_LEVEL_NO_SL1][SCHOOL_CONTROL_COUNT][MINORITY_GROUP_COUNT][PREFERECNE_COUNT2];
00316 #endif
00317     float min_academic_rating[MAX_STUDENT_LEVEL_NO_SL1];
00318 
00319 public:                                         // chwg0621
00320     float app_multiplier[MAX_STUDENT_LEVEL], yield_multiplier[MAX_STUDENT_LEVEL];
00321 
00322 private:
00323     void  init_data_sls(char sl);
00324     void  calc_app_multiplier(char sl);
00325 
00326 public:                                         // chwg0621
00327     void  enroll_main_sls(char sl);
00328     void  update_student_intake();
00329 private:
00330     void  calc_post_enroll_sls(char sl);
00331     void  calc_enroll_aid_sls(char sl);
00332 
00333     //----------------------------------------------------//
00334     //-- data and methods for player's input and output --//
00335     //----------------------------------------------------//
00336 public:
00337     // 1. player input for calc_*_aid
00338     float fraction_sl1_offered_merit_aid;
00339     float fraction_sl2_offered_aid;
00340     float fraction_sl5_offered_aid;               // askbill to add if
00341     char  minority_aid_special;                   // (* 2 = high; 1=medium; 0 = none *) // see SET_HIGH
00342     char  athlete_aid_special;                    // (* 2 = high; 1=medium; 0 = none *)
00343 
00344     // 2. player input for calc_enroll_offers (admissions)
00345     char  offers_priority[TALENT_VAR_COUNT];      // = [0,MAX_TALENT_PRIORITY_LEVEL]
00346     char  minority_offers_special;                // (* 2 = high; 1=medium; 0 = none *)
00347     char  athlete_offers_special;                 // (* 2 = high; 1=medium; 0 = none *)
00348 #if(GAME_VERSION>=200)
00349     char  distance_learner_acceptance;            // (* 2 = actively seek; 1 = accept; 0 = prohibit *)
00350 #endif
00351 
00352     // 3. player input for generate student sims
00353     float fraction_need_covered;
00354     bool  aid_budget_enforced;                    //temp not used
00355 
00356     // 4. for screen Overview
00357     int target_student_intake[MAX_STUDENT_LEVEL];
00358     // chwg0810
00359     double target_student_intake_ratio[MAX_STUDENT_LEVEL];
00360     //## chea 040999 store the value for the last year target ribbon
00361     int last_year_target_student_intake[MAX_STUDENT_LEVEL];
00362 
00363 #if(GAME_VERSION>=200)
00364     int target_enrollment[MAX_STUDENT_LEVEL];
00365 #endif
00366 
00367     // values for interface output
00368     int overall_percent_minority;
00369     int overall_percent_female;
00370 #if(GAME_VERSION>=200)
00371     int overall_percent_minority_female;          // for new formula of diversity
00372     int overall_gender_ethnic_group_student_count[GENDER_ETHNIC_TYPE_COUNT];
00373 #endif
00374     int overall_percent_minority_matric;
00375     int matric_history[MAX_STUDENT_LEVEL_N_TOTAL][HISTORY_GRAPH_COUNT_GENERAL][HISTORY_YEAR_COUNT];
00376 #if(GAME_VERSION>=200)
00377     int distance_credits_provided_history[HISTORY_TRIMESTER_COUNT];
00378 #endif
00379 
00380 private:
00381     void  calc_enroll_aid();
00382     void  player_change_offers_priority();
00383     void  calc_doctoral_intake_target();
00384 
00385     float calc_need_aid(float x);
00386     float calc_merit_aid(float x, float base);
00387     float calc_merit_aid_sls(char sl, float x, float base);
00388     void  adjust_fraction_merit_aid(float& fraction);
00389     float calc_academic_rating(char sl, char subSeg, float academicRating, float base);
00390 };
00391 
00392 extern EnrollRes enroll_res;
00393 #endif                                            //ifndef

Generated on Fri Aug 23 01:37:28 2002 for VirtualU by doxygen1.2.17