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

Password:

Ofacu_pi.cpp Source File
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Ofacu_pi.cpp

Go to the documentation of this file.
00001 //Filename    : OFACULTY.cpp
00002 //Description : FACULTY Class Definition
00003 //Own:                   Fred.
00004 
00005 #include <OMATH.H>
00006 #include <ODEPT.H>
00007 #include <OINFO.H>
00008 #include <ONAMERES.H>
00009 #include <OFPHOTO.H>
00010 #include <OFACULTY.H>
00011 #include <OFINANCE.H>
00012 #include <OPSCHOOL.H>                             // trimester_array
00013 #include <OPEERSCH.H>
00014 #include <OLIBTECH.H>                             // .faculty_incentive_using_it
00015 #include <OCHANCE.H>                              //## chea 091199
00016 
00017 //---------- Begin of function Faculty::update_history -----------//
00023 void Faculty::update_history(char update_flag) {
00024     switch (update_flag) {
00025     case UPDATE_MONTH:
00026         satisfaction_index_last = satisfaction_index;
00027         calc_satisfaction_index();
00028         calc_performance_research();
00029         think_research();                           // 1118
00030         break;
00031     case UPDATE_TRIMESTER:
00032 #if(GAME_VERSION>=200)
00033         satisfaction_index_last_tri = satisfaction_index;
00034 #endif
00035         calc_performance_teaching();
00036         calc_performance_scholarship();
00037         calc_discretionary_hour_it();
00038         break;
00039     case UPDATE_YEAR:
00040         reaction_summer_teaching_last = reaction_summer_teaching;
00041         break;
00042     case UPDATE_ALL:
00043         update_history(UPDATE_MONTH);
00044         update_history(UPDATE_TRIMESTER);
00045         update_history(UPDATE_YEAR);
00046         break;
00047     default:
00048         err_here();
00049         break;
00050     }
00051 }
00052 
00053 //---------- End of function Faculty::update_history -----------//
00054 
00055 //------ Begin of function Faculty::calc_all_performance -------//
00057 void Faculty::calc_all_performance() {
00058     err_here();
00059 
00060     calc_performance_teaching();
00061     calc_performance_scholarship();
00062     calc_performance_research();
00063 
00064     calc_satisfaction_index();
00065 }
00066 
00067 //------- End of function Faculty::calc_all_performance -------//
00068 
00069 //---------- Begin of function Faculty::calc_performance_teaching -----------//
00071 void Faculty::calc_performance_teaching() {
00072     float input7=0;
00073 
00074     //-----------//
00075     input7 = finance.academic_support_ratio;
00076 
00077     //-----------//
00078     float talentTeaching = math.single_response_func(1, 100, 64.99f, 51.96f, talent_teaching);
00079     float performanceScholarship = math.dual_response_func(1, 50, 100, 21.46f, 21.95f, 20.43f, 80, performance_scholarship);
00080     float coursePrepareHour = math.single_response_func(1, 100, 13.05f, 6.85f, discretionary_hour_array[DT_COURSE_PREPARATION]);
00081     float outOfClassContactHour = math.single_response_func(1, 100, 13.05f, 6.85f, discretionary_hour_array[DT_OUT_OF_CLASS_STUDENT_CONTACT]);
00082     float contactHourRatio = math.dual_response_func(1, 50, 100, -0.456f, -0.461f, 1.544f, 0.452f, float(teaching_contact_hour)/NORMAL_TEACHING_CONTACT_HOUR);
00083     input7 = math.dual_response_func(1, 47.34f, 100, 0.216f, 0.431f, 0.119f, 0.657f, input7);
00084 
00085     float overallValue = talentTeaching * 0.2f +
00086         performanceScholarship * 0.25f +
00087         coursePrepareHour * 0.15f +
00088         outOfClassContactHour * 0.1f +
00089         contactHourRatio * 0.1f +
00090         satisfaction_index_last * 0.1f +
00091         input7 * 0.1f;
00092 
00093     //  performance_teaching = math.latency_func( 0.79f, performance_teaching, overallValue);
00094     //## chea 300899 change latency_func(HE.RespF_Defs.Rev 230899 E-mail)
00095     performance_teaching = player_school.latency_func( 0.65f, performance_teaching, overallValue);
00096 
00097 }
00098 
00099 //---------- End of function Faculty::calc_performance_teaching -----------//
00100 
00101 //---------- Begin of function Faculty::calc_performance_scholarship -----------//
00103 void Faculty::calc_performance_scholarship() {
00104     float input3 = finance.academic_support_ratio;
00105 
00106     //----------------//
00107     float talentScholarship = math.single_response_func(1, 100, 64.99f, 51.96f, talent_scholarship);
00108     float performanceResearch = math.dual_response_func(1, 50, 100, 21.02f, 34.78f, 19.75f, 75.56f, performance_research);
00109     float scholarshipHour = math.single_response_func(1, 100, 13.23f, 6.40f, discretionary_hour_array[DT_SCHOLARSHIP]);
00110 
00111     input3 = math.dual_response_func(1, 49.62f, 100, 0.243f, 0.303f, 0.124f, 0.634f, input3);
00112 
00113     //## chea 221099
00114     if(this->rank_level ==3 || this->rank_level ==4) {
00115         //              talentScholarship = 0.0f;
00116         //              performanceResearch = 0.0f;
00117         scholarshipHour = 0.0f;
00118 
00119     }
00120 
00121     float overallValue = talentScholarship * 0.3f +
00122         performanceResearch * 0.1f +
00123         scholarshipHour * 0.3f +
00124         satisfaction_index_last * 0.1f +
00125         input3 *0.2f;
00126 
00127     //  performance_scholarship = math.latency_func( 0.94f, performance_scholarship, overallValue);
00128     //## chea 300899 change latency_func(HE.RespF_Defs.Rev 230899 E-mail)
00129     performance_scholarship = player_school.latency_func( 0.70f, performance_scholarship, overallValue);
00130 
00131     //## chea 221099
00132     //  if(this->rank_level ==3 || this->rank_level ==4)
00133     //          performance_scholarship = 0.0f;
00134 
00135 }
00136 
00137 //---------- End of function Faculty::calc_performance_scholarship -----------//
00138 
00139 //---------- Begin of function Faculty::calc_performance_research -----------//
00141 void Faculty::calc_performance_research() {
00142     float input4 = finance.academic_support_ratio;
00143 
00144     //----------------//
00145     float talentResearch = math.single_response_func(1, 100, 29.02f, 60.37f, talent_research);
00146     float performanceScholarship = math.single_response_func(1, 100, 33.39f, 31.36f, performance_scholarship);
00147     float researchHour  = math.single_response_func(1, 100, 24.67f, 13.69f, discretionary_hour_array[DT_RESEARCH]);
00148     float researchRatio;
00149 
00150     float researchNorm = (float) department_array[department_recno]->research_dollar_norm;
00151 
00152     if( researchNorm )
00153         researchRatio = math.single_response_func(1, 100, 6.57f, 1.79f, research_month_expense / researchNorm );
00154     else
00155         researchRatio = 0;
00156 
00157     //## chea 221099
00158     if(rank_level ==3 || rank_level ==4) {
00159         researchHour = 0.0f;
00160         //              talentResearch = 0.0f;
00161         //              performanceScholarship = 0.0f;
00162         researchRatio = 0.0f;
00163     }
00164 
00165     input4 = math.dual_response_func(1, 49.81f, 100, 0.295f, 0.510f, 0.150f, 0.860f, input4);
00166 
00167     //----------------//
00168 
00169     float newValue = talentResearch * 0.3f +
00170         performanceScholarship * 0.1f +
00171         researchHour * 0.2f +
00172         researchRatio * 0.35f +
00173         input4 * 0.05f;
00174 
00175     //## chea 300899 change latency_func(HE.RespF_Defs.Rev 230899 E-mail)
00176     performance_research = player_school.latency_func( 0.75f, performance_research, newValue);
00177 
00178     //---------- extra effect brought the chance cards ------------//
00179 
00180     if( extra_effect_performance_research ) {
00181         performance_research *= extra_effect_performance_research;
00182 
00183         extra_effect_performance_research += (1.0f - extra_effect_performance_research) * 0.3f;
00184 
00185         performance_research = max(0, min(100,performance_research ) );
00186     }
00187 }
00188 
00189 //---------- End of function Faculty::calc_performance_research -----------//
00190 
00191 //---------- Begin of function Faculty::calc_discretionary_hour_it -----------//
00193 void Faculty::calc_discretionary_hour_it() {
00194     float input[2];
00195 
00196     //--------------//
00197     input[0] = discretionary_hour_array[DT_EDUCATIONAL_DEVELOPMENT]
00198         * float( float(finance.expense_array[AC_IT_RESOURCES].total) / finance.total_operating_expense.total );
00199 
00200     input[0] *= (float) finance.cost_rise_policy_array[PL_INFO_TECH_RESOURCES].penalty_multiplier2;
00201 
00202     //--------------//
00203     input[0] = math.dual_response_func(0,60.23f,100,0.076f,0.112f,0.033f,0.150f, input[0]);
00204     input[1] = math.dual_response_func(0,51.1f,75,32.26f,26.33f,19.66f,68.16f, library_tech_office.faculty_incentive_using_it);
00205 
00206     float newValue = 0.5f * input[0] + 0.5f * input[1];
00207 
00208     p_discretionary_hour_it_percent = player_school.latency_func( 0.8f, p_discretionary_hour_it, newValue);
00209 
00210     //--------------//
00211     int totalDTTime = 0;
00212     for (int i=0; i<DISCRETIONARY_TYPE_COUNT; i++)
00213         totalDTTime += discretionary_hour_array[i];
00214 
00215     p_discretionary_hour_it = totalDTTime * p_discretionary_hour_it_percent / 100;
00216 
00217 }
00218 
00219 //---------- End of function Faculty::calc_discretionary_hour_it -----------//
00220 
00221 //---------- Begin of function Faculty::calc_satisfaction_index -----------//
00223 void Faculty::calc_satisfaction_index() {
00224 #define VAR_COUNT   8
00225 
00226     float input[VAR_COUNT];
00227     memset(input, 0, sizeof(input));
00228 
00229     int i;
00230 
00231     //--------------//
00232 
00233     float peerAvg = (float) PeerSchool::average_faculty_salary[ rank_age_group() ];
00234 
00235     if ( peerAvg > 0 )
00236         input[0] = salary / peerAvg;
00237 
00238     //--------------//
00239     input[1] = float(teaching_contact_hour) / NORMAL_TEACHING_CONTACT_HOUR;
00240 
00241     //--------------//
00242     input[2] = player_school.sub_score[S_FACULTY_DIVERSITY][THIS_MONTH];
00243 
00244     //--------------//
00245     input[3] = player_school.sub_score[S_STUDENT_DIVERSITY][THIS_MONTH];
00246 
00247     //--------------//
00248     /*  Equals:
00249 
00250         50 + sum over i of:
00251         weight[i] * (performance[i] - talent[i])/
00252         sum of the weights,
00253         truncated to be between 0 and 100.
00254 
00255         where
00256         weight[i] = institutional priority[i] amd "i" ranges over teaching, scholarship, and research.
00257 
00258         The institutional priorities for T, S, and R are on the Faculty_Incentives sheet.
00259     */
00260     const char V_COUNT = 3;
00261     float subInput[V_COUNT], weight[V_COUNT];
00262 
00263     //  a percentage from 0 to 100
00264     subInput[0] = performance_teaching - talent_teaching;
00265     subInput[1] = performance_scholarship - talent_scholarship;
00266     subInput[2] = performance_research - talent_research;
00267 
00268     weight[0] = department_array.weight_teaching;
00269     weight[1] = department_array.weight_scholarship;
00270     weight[2] = department_array.weight_research;
00271 
00272     for (i=0; i<V_COUNT; i++)
00273         input[4] += weight[i] * subInput[i];
00274 
00275     //min & max bug chea
00276     input[4] = max(0.0f,min(100.0f, 50 + input[4] / (weight[0]+weight[1]+weight[2])));
00277 
00278     err_when((weight[0]+weight[1]+weight[2])==0);
00279 
00280     //--------------//
00281     // Strain on discretionary time due to institutional priorities
00282     input[5] = strain_on_discretionary_time;
00283 
00284     //--------------//
00285     // Reaction to emphasis on summer teaching
00286     // Let x[t] = the value of the emphasis variable (0,1,2, or 3) at month t, TIMES
00287     // (percent of summer teaching as part of regular faculty load)/100 ; . Then:
00288 
00289     //float emphasis_var, emphasis_var_last;
00290     //emphasis_var = emphasis_var_last = 1;             // changed monthly // to put it to "student Union"?
00291 
00292     const float lamda = 0.98f;
00293 
00294     reaction_summer_teaching = max(0.0f,
00295                                    (1-lamda)*(-10)*(player_school.summer_emphasis*player_school.summer_emphasis - player_school.summer_emphasis_last*player_school.summer_emphasis_last)
00296                                    + lamda*reaction_summer_teaching_last);       //min & max bug chea
00297 
00298     input[6] = reaction_summer_teaching;
00299 
00300     //--------------//
00301     // -1:last year
00302     input[7] = department_array[department_recno]->p_academic_standing_history[THIS_YEAR-1];
00303 
00304     //--------------//
00305     input[0] = math.dual_response_func(1, 50, 100, 0.123f, 0.123f, 0.863f, 1.136f, input[0]);
00306     input[1] = math.dual_response_func(1, 50, 100, -0.214f, -0.132f, 1.075f, 0.688f, input[1]);
00307     input[2] = math.dual_response_func(1,49.48f,100,20.74f,29.48f,20.30f,75.12f, input[2]);
00308     input[3] = math.dual_response_func(1,49.48f,100,20.74f,29.48f,20.30f,75.12f, input[3]);
00309     input[5] = math.single_response_func(100,0,-100.5f,49.07f, input[5]);
00310 
00311     //--------------//
00312     float weightWhiteMale[VAR_COUNT] = { 0.25f,0.20f,0.05f,0.05f,0.15f,0.15f,0.05f,0.10f,};
00313     float weightOther[VAR_COUNT] = {0.25f,0.20f,0.10f,0.10f,0.10f,0.10f,0.05f,0.10f,};
00314 
00315     float newValue = 0;
00316 
00317     if ( gender_ethnic_group == NONMINORITY_MALE ) {
00318         for (i=0; i<VAR_COUNT; i++)
00319             newValue += weightWhiteMale[i] * input[i];
00320     }
00321     else {
00322         for (i=0; i<VAR_COUNT; i++)
00323             newValue += weightOther[i] * input[i];
00324     }
00325 
00326 #if(GAME_VERSION>=200)
00327     if ( is_dismissed )
00328         newValue *= 0.1;
00329 #endif
00330 
00331     //  satisfaction_index = math.latency_func( 0.80f, satisfaction_index, newValue);
00332     //## chea 300899 change latency_func(HE.RespF_Defs.Rev 230899 E-mail)
00333     satisfaction_index = player_school.latency_func( 0.20f, satisfaction_index, newValue);
00334 
00335     // var 12 in respone_func.xls
00336     if ( rank_level == ASST_PROF ) {
00337         // scale to =[0,100]
00338         int promoDiff = (player_school.faculty_promotion_difficulity - INPUT_LOW ) * 100 / (INPUT_HIGH - INPUT_LOW);
00339 
00340         satisfaction_index *= (1 - 0.2f * (promoDiff - 50) / 100 );
00341         //min & max bug chea
00342         satisfaction_index = max(0.0f, min(100.0f, satisfaction_index));
00343     }
00344 
00345     //----------------------------//
00346     // 1020 add penalty, if any; // 1118
00347 
00348     satisfaction_index *= (float) finance.revenue_policy_array[PL_ENDOWMENT_SPENDING_RATE].penalty_multiplier1;
00349     satisfaction_index *= (float) finance.revenue_policy_array[PL_INDIRECT_COST_RATE].penalty_multiplier1;
00350 
00351     satisfaction_index *= (float) finance.expense_policy_array[PL_FACULTY_SALARY_INCREASES].penalty_multiplier1;
00352     //satisfaction_index *= (float) finance.expense_policy_array[PL_REAL_TRANSFER_TO_PLANT_GROWTH].penalty_multiplier1;
00353     satisfaction_index *= (float) finance.expense_policy_array[PL_BUDGET_ADJUSTMENT].penalty_multiplier1;
00354 
00355     //---//
00356     satisfaction_index *= (float) finance.cost_rise_policy_array[PL_FACULTY_FTE].penalty_multiplier1;
00357     satisfaction_index *= (float) finance.cost_rise_policy_array[PL_NON_FACULTY_DEPARTMENTAL_EXPENSE].penalty_multiplier1;
00358     satisfaction_index *= (float) finance.cost_rise_policy_array[PL_LIBRARIES].penalty_multiplier1;
00359 
00360     //---- chance card extra effect ------//
00361 
00362     if( extra_effect_satisfaction_index ) {
00363         satisfaction_index *= extra_effect_satisfaction_index;
00364 
00365         extra_effect_satisfaction_index += (1.0f - extra_effect_satisfaction_index) * 0.3f;
00366     }
00367 
00368     //--------- cap the value ------------//
00369 
00370     //min & max bug chea
00371     satisfaction_index = max(0.0f,min(100.0f,satisfaction_index));
00372 
00373 }
00374 
00375 //---------- End of function Faculty::calc_satisfaction_index -----------//

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