import java.lang.Object; /* * * Task * */ class Task extends Object { // Number of variables public static final int NUMBER_OF_VARIABLES = 6; private static int size = 7; private static int count = 6; private static double maximum = 32768.0; private static int number_of_usefulness = 5; private static int number_of_tests = 500; //public int NUMBER_OF_VARIABLES1 = 3; public double lowerBounds[]; public double upperBounds[]; public double initialPoints[]; public static int isReliability; public static double bank_reliability[]; /*-- The Data Section --------------------------------------*/ /* Amount of all loans */ static double bank_loans[];// = {361633000.0, /*Hermis */ // 49480000.0, /*Siauliu*/ // 120054000.0, /*Ukio */ // 477184000.0, /*Vilnius*/ // 564608000.0, /*LTB */ // 808263000.0}; /*LZUB */ /* All other data is given respectively*/ /* Amount of bad loans */ static double bank_badln[];// = { 41682800.0, // 696800.0, // 6841000.0, // 35402800.0, // 47817000.0, // 85431000.0}; /* Amount of capital */ static double bank_capital[];//= {741614000.0, // 95093000.0, // 216860000.0, // 1121016000.0, // 1428075000.0, // 1336420000.0 }; /* Amount of deposits */ static double bank_deposits[]; //= {542408000.0, // 40603000.0, // 168497000.0, // 777898000.0, // 1300958000.0, // 1163036000.0 }; /* Amount of secured deposits */ static double bank_securdep[];//= {1245600.0, // 624500.0, // 1150100.0, // 1711000.0, // 1265400.0, // 1078000.0 }; /* Amount of shares in LTL */ static double bank_shares[];//= {1087350.0, // 680420.0, // 3500000.0, // 2038000.0, // 600000.0, // 732546.0 }; /* Amount of operation costs */ static double bank_costs[];//= {9366000.0, // 1814000.0, // 5852000.0, // 13161000.0, // 23318000.0, // 19572000.0 }; /* Income from operation */ static double bank_income[];//= {32985000.0, // 4262000.0, // 7945000.0, // 48513000.0, // 54164000.0, // 71260000.0 }; /* Amount of percents paid */ /* 6 - mounths deposits */ static double percents_paid[];//= {.075, /*Hermis */ // .105, /*Siauliai*/ // .100, /*Ukio */ // .072, /*Vilnius */ // .060, /*LTB */ // .057, /*LZUB */ // .000 }; /* Home */ /* Usefulness */ /* { cash, usefulness } */ //double usefulness[number_of_usefulness][2] = {{0. ,0. }, static double usefulness[][];// = {{0. ,0. }, // {500. ,0.4}, // {1000. ,0.7}, // {1500. ,0.9}, // {2000. ,1. }}; /* */ //double weight[5] = {.25, /* credit risk */ static double weight[];// = {.25, /* credit risk */ // .35, /* liquidity risk */ // .30, /* loan norm risk */ // .05, /* income risk */ // .10}; /* solvency risk */ /*-- End of Data Section -----------------------------------*/ public void fill(double param[], double first, double second, double third, double fourth, double fifth, double sixth) { param[0] = first; param[1] = second; param[2] = third; param[3] = fourth; param[4] = fifth; param[5] = sixth; } public Task() { // Initialize upper and lower bounds or initial points here: lowerBounds = new double[NUMBER_OF_VARIABLES]; upperBounds = new double[NUMBER_OF_VARIABLES]; initialPoints = new double[NUMBER_OF_VARIABLES]; for ( int i = 0; i < NUMBER_OF_VARIABLES; i++ ) { lowerBounds[i] = -5.0; upperBounds[i] = 5.0; } initialPoints[0] = 4;//2; initialPoints[1] = 0;//-4; bank_reliability = new double[size]; bank_loans = new double[count]; bank_badln = new double[count]; bank_capital =new double [count]; bank_deposits = new double[count]; bank_securdep= new double[count]; bank_shares = new double[count]; bank_costs = new double[count]; bank_income = new double[count]; percents_paid = new double[size]; usefulness = new double[number_of_usefulness+1][2]; weight = new double[5]; fill(bank_loans,361633000.0, /*Hermis */ 49480000.0, /*Siauliu*/ 120054000.0, /*Ukio */ 477184000.0, /*Vilnius*/ 564608000.0, /*LTB */ 808263000.0); /*LZUB */ /* All other data is given respectively*/ /* Amount of bad loans */ fill(bank_badln, 41682800.0, 696800.0, 6841000.0, 35402800.0, 47817000.0, 85431000.0); /* Amount of capital */ fill(bank_capital,741614000.0, 95093000.0, 216860000.0, 1121016000.0, 1428075000.0, 1336420000.0 ); /* Amount of deposits */ fill(bank_deposits,542408000.0, 40603000.0, 168497000.0, 777898000.0, 1300958000.0, 1163036000.0 ); /* Amount of secured deposits */ fill(bank_securdep,1245600.0, 624500.0, 1150100.0, 1711000.0, 1265400.0, 1078000.0 ); /* Amount of shares in LTL */ fill(bank_shares,1087350.0, 680420.0, 3500000.0, 2038000.0, 600000.0, 732546.0 ); /* Amount of operation costs */ fill(bank_costs, 9366000.0, 1814000.0, 5852000.0, 13161000.0, 23318000.0, 19572000.0 ); /* Income from operation */ fill( bank_income,32985000.0, 4262000.0, 7945000.0, 48513000.0, 54164000.0, 71260000.0 ); /* Amount of percents paid */ /* 6 - mounths deposits */ percents_paid[0]= .075; /*Hermis */ percents_paid[0]=.105; /*Siauliai*/ percents_paid[0]=.100; /*Ukio */ percents_paid[0]=.072; /*Vilnius */ percents_paid[0]=.060; /*LTB */ percents_paid[0]=.057; /*LZUB */ percents_paid[0]=.000; /* Home */ /* Usefulness */ /* { cash, usefulness } */ //double usefulness[number_of_usefulness][2] = {{0. ,0. }, usefulness[0][0] =0; usefulness[0][1] =0; usefulness[1][0] =500.; usefulness[1][1] =0.4; usefulness[2][0] =1000.; usefulness[2][1] =0.7; usefulness[3][0] =1500.; usefulness[3][1] =0.9; usefulness[4][0] =2000.; usefulness[4][1] =1; usefulness[5][0] =3000.; usefulness[5][1] =1; /* */ //double weight[5] = {.25, /* credit risk */ weight[0] = .25; weight[1] = .35; weight[2] = .30; weight[3] = .05; weight[4] = .10; //static double weight[] = {.25, /* credit risk */ // .35, /* liquidity risk */ // .30, /* loan norm risk */ // .05, /* income risk */ // .10}; /* solvency risk */ } /*-- Risk calculation functions ----------------------------*/ /* Credit Risk */ static double creditRisk(double bad_loans,double all_loans) { return ( 1 - (bad_loans / all_loans)); }; /* Liquidity Risk */ static double liquidRisk( double all_loans, double all_capital) { return ( 1 - (all_loans / all_capital)); } /* Loan N Risk */ static double loanNrRisk( double sec_deposits, double all_deposits) { return (sec_deposits / all_deposits); } /* Income Risk */ static double IncomeRisk( double operation_income, double operation_cost) { return (1-(operation_income / operation_cost)); } /* Solvency Risk */ static double SolvncRisk( double shares, double all_capital) { return (shares/all_capital); } /* Reliability of the Bank */ static double reliability( double crdR, double liqR, double lnNR, double IncR, double slvR) { return ( crdR * weight[0] + liqR * weight[1] + lnNR * weight[2] + IncR * weight[3] + slvR * weight[4]) * 1.65; } /* Reliability of Home */ static double reliabilityH( double robberys, double population) { return (1-(robberys/population)); } /* Fill Reliability vector */ static void fillReliabilityVector() { int i; for (i = 0; i < 6; i++ ) bank_reliability[i] = reliability(creditRisk(bank_badln[i],bank_loans[i]), liquidRisk(bank_loans[i],bank_capital[i]), loanNrRisk(bank_securdep[i],bank_deposits[i]), IncomeRisk(bank_income[i],bank_costs[i]), SolvncRisk(bank_shares[i],bank_capital[i])); bank_reliability[6] = 1 - reliabilityH(8000,300000); } /* printing the vector x */ /* void printVector( double *x, int size) { int i; for(i=0;iusefulness[l][0])&(dWins