⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hartmut_documentation

📁 linux下的源码分类器SVM
💻
📖 第 1 页 / 共 5 页
字号:
   Same idea as always. Reserve space for array, strtod values into this array,   call add_lag_con and free array.void add_column(lprec *lp, REAL *column)   update columns and sums,   increment space for columns and matrix    if scaling used      set scaling factor for column to "1" and scale all values with row[scaling].   for all elements in (dense) column      if value is not zero         write it in matrix.   update col_end          orig_lowbo          orig_upbo          lower          basis          must_be_int          invent perhaps name for column   row_end_valid = FALSE   if lp = active      set sum, columns, non_zerosvoid str_add_column(lprec *lp, char *col_string)   Same idea as always. Reserve space for array, strtod values into this array,   call add_column and free array.void del_column(lprec *lp, int column)   check, if column is in range   if column in Basis set basis_valid to FALSE      else update bas   shift names_used,         must_be_int         orig_upbo         orig_lowbo         upbo         lowbo         basis         lower         scaling   update lagrangean stuff   copy elements in matrix down.   update col_end   update non_zeros   row_end_valid = FALSE   eta_valid = FALSE   update sum          column   if lp = active      set_globals()void set_upbo(lprec *lp, int column, REAL value)   Test if column number in range   scale value   Test, if new value is feasible (greater than lower bound)   eta_valid = FALSE   set orig_upbovoid set_lowbo(lprec *lp, int column, REAL value)   Test if column number in range   scale value   Test, if new value is feasible (smaller than upper bound)   eta_valid = FALSE   set orig_lowbovoid set_int(lprec *lp, int column, short must_be_int)   Test if column number in range   set must_be_int   If variable must be integer, unscale columnvoid set_rh(lprec *lp, int row, REAL value)   Test, if row_number is in range   Test, if row_number for objective row should be set, WARNING   scale value and change sign.   eta_valid = FALSEvoid set_rh_vec(lprec *lp, REAL *rh)   For all rows      scale and change sign      set orig_rh   eta_valid = FALSEvoid str_set_rh_vec(lprec *lp, char *rh_string)   Same idea as always. Reserve space for array, strtod values into this array,   call set_rh_vec and free array.void set_maxim(lprec *lp)   if maxim == FALSE      multiply all Values in row[0] with -1      eta_valid = FALSE   set maximise = TRUE       ch_sign[0] = TRUE   if LP = active, set Maximise = TRUEvoid set_minim(lprec *lp)   if maxim == TRUE      multiply all Values in row[0] with -1      eta_valid = FALSE   set maximise = FALSE       ch_sign[0] = FALSE   if LP = active, set Maximise = FALSEvoid set_constr_type(lprec *lp, int row, short con_type)   Test, if row_number is in range   if type == EQUAL      set upper bound on slackvariable to zero      basis_valid == FALSE      if change_sign[row]         multiply all coefficients with -1         eta_valid = FALSE         change_sign = FALSE         change sign of orig_rh   if type == LESSEQUAL      set upper bound on slackvariable to infinity      basis_valid == FALSE      if change_sign[row]         multiply all coefficients with -1         eta_valid = FALSE         change_sign = FALSE         change sign of orig_rh   if type == GREATEREQUAL      set upper bound on slackvariable to infinity      basis_valid == FALSE      if NOT change_sign[row]         multiply all coefficients with -1         eta_valid = FALSE         change_sign = TRUE         change sign of orig_rh   else      error wrong constraint type   REAL mat_elm(lprec *lp, int row, int column)   /* get value of matrix element in row and column */   Test, if row_number is in range   Test, if col_number is in range   value = 0   loop through column   if value found      unscale and change_sign   return valuevoid get_row(lprec *lp, int row_nr, REAL *row)   /* this is dense form */   Test, if row_number is in range   for all columns      initialise value with 0      for all entries in column         if row found, write value      unscale value   if change_sign      multiply with -1   void get_column(lprec *lp, int col_nr, REAL *column)   Test, if column is in range.   /* column is dense*/    initialise columnarray with 0   for all elements in this colum, copy to dense array   unscale and change signvoid get_reduced_costs(lprec *lp, REAL *rc)   Basis has to be valid   set_globals   if eta_valid = FALSE      invert   initialise array with 0   set rc[0] = 1   btran(rc)   For all columns      if variable not in basis AND upper bound > 0         rc[column] = SUM (over all elements in Column) mat.value * rc[row]   round all values   short is_feasible(lprec *lp, REAL *values)   Unscale values and look, if they are between orig_lower and orig_upper bounds   allocate space for a new rhs   With this values calculate rhs   check if rhs is lessequal than orig rhs for LE rows and equal to orig_rhs      for EQ rows.      short column_in_lp(lprec *lp, REAL *testcolumn)   for all columns      for all elements in column         unscale value and change_sign         check if difference smaller than epsilon   return TRUE or FALSEvoid print_lp(lprec *lp)   print rowwise in readable form.void set_row_name(lprec *lp, int row, nstring new_name)   Perhaps allocate memory for names and initialise with default names   strcpy rownamevoid set_col_name(lprec *lp, int column, nstring new_name)   Perhaps allocate memory for names and initialise with default names   strcpy colnamestatic REAL minmax_to_scale(REAL min, REAL max)   calculate scaling factor depending on min and maxvoid unscale_columns(lprec *lp)   for all columns      for all coefficients in column         unscale (columnscaling)   for all columns      unscale bounds   set scaling vector to 1   columns_scaled = FALSE   eta_valid = FALSEvoid unscale(lprec *lp)   Work only if scaling used   for all columns      for all coefficients in column         unscale (columnscaling)   for all columns      unscale bounds   for all columns      for all coefficients in column         unscale (rowscaling)   for all rows      unscale orig_rhs   free scale   scaling_used = FALSE   eta_valid = FALSEvoid auto_scale(lprec *lp)   find row maximum and row minimum. Use these values to scale problem.void reset_basis(lprec *lp)   basis_valid=FALSEvoid print_solution(lprec *lp)   Print solution to stdout   Print all variables   In some cases      Print slack variables ???      Print dualsvoid write_LP(lprec *lp, FILE *output)   print LP rowwise in readable form.   void write_MPS(lprec *lp, FILE *output)   The routine write_MPS seems to do no unscaling. However it uses internally   the routine get_column() which does unscaling!void print_duals(lprec *lp)Print all dualsvoid print_scales(lprec *lp)   Print all row scales   print all column scales./***************************************************************//**                                                           **//**                                                           **//**             Routines in file "read.c"                     **//**                                                           **//**                                                           **//***************************************************************/void yyerror(char *string)void check_decl(char *str)static int hashval(const char *string)static hashelem *gethash(char *variable)void add_int_var(char *name)void init_read(void)static column *getrow(column *p,                      int row)static bound *create_bound_rec(void)void null_tmp_store(void)static void store(char *variable,                  int row,                  REAL value)void store_re_op(void)void rhs_store(REAL value)void var_store(char *var, int row, REAL value)void store_bounds(void)void add_constraint_name(char *name, int row)void readinput(lprec *lp)lprec *read_lp_file(FILE *input, short verbose, nstring lp_name)===================================================To understand the idea of this file you should also read carefully the comments directly at the beginning of this file! void yyerror(char *string)   Output error string and line numbervoid check_decl(char *str)   We expect string "int". If this is not the case give error message.static int hashval(const char *string)   Calculate an integer hash value. (Modulo HASHSIZE).static hashelem *gethash(char *variable)   Returns a pointer to hashelement with name = variable.   If this hashelement does not exist, gethash() returns a NULL pointer.void add_int_var(char *name)   Check if name exists. (if not, error message.)   Check if it is the first time this variable was declared to be integer.   Set flag for this variable to be integer.void init_read(void)   Init hashtable and globals.static column *getrow(column *p,                      int row)   search in column-list (p is pointer to first element of column-list)   for column->row = row.   getrow() returns a pointer to this column structure.   If not found a NULL-pointer is returned   Follows one chain of pointers until correct element is found.static bound *create_bound_rec(void)   Creates a bound record.   Calloc space.   Set lowbo = 0 and upbo = Infinite   Return pointer to this structure.void null_tmp_store(void)   clears the tmp_store variable after all information has been copiedstatic void store(char *variable,                  int row,                  REAL value)   Store a value of the (sparse) matrix in data structure.   If Value == 0, display warning.   Three cases have to be distinguished:   First: Variable does not exist          Calloc space for info about variable          update number of variables          insert this element first into hashtable          Calloc space for value          insert rownumber and value into structure   Second: Variable exists and has no value in that row yet          Calloc space for value          Insert rownumber and value into structure and insert into pointer          chain.   Third: Variable exists and has already a value in that row.          add value to old value.void store_re_op(void)   switch yytext[0]   case =   case >   case <   default   error exitvoid rhs_store(REAL value

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -