protected void calculate_working_set(){
  if (working_set_size < parameters_working_set_size) {
    working_set_size=parameters_working_set_size;
    if (working_set_size > examples_total) {
      working_set_size=examples_total;
    }
  }
  ;
  heap_min.init(working_set_size / 2);
  heap_max.init(working_set_size / 2 + working_set_size % 2);
  int i=0;
  double the_nabla;
  boolean is_feasible;
  int j;
  if (target_count < 3) {
    while (i < examples_total) {
      is_feasible=feasible(i);
      if (is_feasible) {
        the_nabla=nabla(i);
        heap_max.add(the_nabla,i);
        heap_min.add(the_nabla,i);
      }
      ;
      i++;
    }
    ;
  }
 else {
    while (i < examples_total) {
      is_feasible=feasible(i);
      if (is_feasible) {
        the_nabla=lambda(i);
        heap_max.add(the_nabla,i);
        heap_min.add(the_nabla,i);
      }
      ;
      i++;
    }
    ;
  }
  ;
  int[] new_ws=heap_min.get_values();
  working_set_size=0;
  int pos;
  j=heap_min.size();
  for (i=0; i < j; i++) {
    working_set[working_set_size]=new_ws[i];
    working_set_size++;
  }
  ;
  pos=working_set_size;
  new_ws=heap_max.get_values();
  j=heap_max.size();
  for (i=0; i < j; i++) {
    working_set[working_set_size]=new_ws[i];
    working_set_size++;
  }
  ;
  if (!heap_min.empty() && !heap_max.empty()) {
    if (heap_min.top_value() >= heap_max.top_value()) {
      j=0;
      i=0;
      while (i < pos) {
        j=pos;
        while (j < working_set_size && working_set[j] != working_set[i]) {
          j++;
        }
        ;
        if (j < working_set_size) {
          working_set[j]=working_set[working_set_size - 1];
          working_set_size--;
        }
 else {
          i++;
        }
        ;
      }
      ;
    }
    ;
  }
  ;
  if (target_count > 1) {
    int pos_abs;
    boolean bounded_pos=true;
    boolean bounded_neg=true;
    pos=0;
    double alpha;
    while (pos < working_set_size && (bounded_pos || bounded_neg)) {
      pos_abs=working_set[pos];
      alpha=alphas[pos_abs];
      if (alpha - C < -is_zero) {
        bounded_pos=false;
      }
      ;
      if (alpha > is_zero) {
        bounded_neg=false;
      }
      ;
      pos++;
    }
    ;
    if (bounded_pos) {
      double max_lambda=Double.MAX_VALUE;
      int max_pos=examples_total;
      for (pos_abs=0; pos_abs < examples_total; pos_abs++) {
        alpha=alphas[pos_abs];
        if (alpha - C < -is_zero) {
          if (lambda(pos_abs) < max_lambda) {
            max_lambda=lambda(pos_abs);
            max_pos=pos_abs;
          }
          ;
        }
        ;
      }
      ;
      if (max_pos < examples_total) {
        if (working_set_size < parameters_working_set_size) {
          working_set_size++;
        }
        ;
        working_set[working_set_size - 1]=max_pos;
      }
      ;
    }
 else     if (bounded_neg) {
      double max_lambda=Double.MAX_VALUE;
      int max_pos=examples_total;
      for (pos_abs=0; pos_abs < examples_total; pos_abs++) {
        alpha=alphas[pos_abs];
        if (alpha > is_zero) {
          if (lambda(pos_abs) < max_lambda) {
            max_lambda=lambda(pos_abs);
            max_pos=pos_abs;
          }
          ;
        }
        ;
      }
      ;
      if (max_pos < examples_total) {
        if (working_set_size < parameters_working_set_size) {
          working_set_size++;
        }
        ;
        working_set[working_set_size - 1]=max_pos;
      }
      ;
    }
    ;
  }
  ;
  if (working_set_size < parameters_working_set_size && working_set_size < examples_total) {
    pos=(int)(Math.random() * examples_total);
    int ok;
    while (working_set_size < parameters_working_set_size && working_set_size < examples_total) {
      ok=1;
      for (i=0; i < working_set_size; i++) {
        if (working_set[i] == pos) {
          ok=0;
          i=working_set_size;
        }
        ;
      }
      ;
      if (1 == ok) {
        working_set[working_set_size]=pos;
        working_set_size++;
      }
      ;
      pos=(pos + 1) % examples_total;
    }
    ;
  }
  ;
}

protected void calculate_working_set ( ) { if ( working_set_size < parameters_working_set_size ) { working_set_size = parameters_working_set_size ; if ( working_set_size > examples_total ) { working_set_size = examples_total ; } } ; heap_min . init ( working_set_size / 2 ) ; heap_max . init ( working_set_size / 2 + working_set_size % 2 ) ; int i = 0 ; double the_nabla ; boolean is_feasible ; int j ; if ( target_count < 3 ) { while ( i < examples_total ) { is_feasible = feasible ( i ) ; if ( is_feasible ) { the_nabla = nabla ( i ) ; heap_max . add ( the_nabla , i ) ; heap_min . add ( the_nabla , i ) ; } ; i ++ ; } ; } else { while ( i < examples_total ) { is_feasible = feasible ( i ) ; if ( is_feasible ) { the_nabla = lambda ( i ) ; heap_max . add ( the_nabla , i ) ; heap_min . add ( the_nabla , i ) ; } ; i ++ ; } ; } ; int [ ] new_ws = heap_min . get_values ( ) ; working_set_size = 0 ; int pos ; j = heap_min . size ( ) ; for ( i = 0 ; i < j ; i ++ ) { working_set [ working_set_size ] = new_ws [ i ] ; working_set_size ++ ; } ; pos = working_set_size ; new_ws = heap_max . get_values ( ) ; j = heap_max . size ( ) ; for ( i = 0 ; i < j ; i ++ ) { working_set [ working_set_size ] = new_ws [ i ] ; working_set_size ++ ; } ; if ( ! heap_min . empty ( ) && ! heap_max . empty ( ) ) { if ( heap_min . top_value ( ) >= heap_max . top_value ( ) ) { j = 0 ; i = 0 ; while ( i < pos ) { j = pos ; while ( j < working_set_size && working_set [ j ] != working_set [ i ] ) { j ++ ; } ; if ( j < working_set_size ) { working_set [ j ] = working_set [ working_set_size - 1 ] ; working_set_size -- ; } else { i ++ ; } ; } ; } ; } ; if ( target_count > 1 ) { int pos_abs ; boolean bounded_pos = true ; boolean bounded_neg = true ; pos = 0 ; double alpha ; while ( pos < working_set_size && ( bounded_pos || bounded_neg ) ) { pos_abs = working_set [ pos ] ; alpha = alphas [ pos_abs ] ; if ( alpha - C < - is_zero ) { bounded_pos = false ; } ; if ( alpha > is_zero ) { bounded_neg = false ; } ; pos ++ ; } ; if ( bounded_pos ) { double max_lambda = Double . MAX_VALUE ; int max_pos = examples_total ; for ( pos_abs = 0 ; pos_abs < examples_total ; pos_abs ++ ) { alpha = alphas [ pos_abs ] ; if ( alpha - C < - is_zero ) { if ( lambda ( pos_abs ) < max_lambda ) { max_lambda = lambda ( pos_abs ) ; max_pos = pos_abs ; } ; } ; } ; if ( max_pos < examples_total ) { if ( working_set_size < parameters_working_set_size ) { working_set_size ++ ; } ; working_set [ working_set_size - 1 ] = max_pos ; } ; } else if ( bounded_neg ) { double max_lambda = Double . MAX_VALUE ; int max_pos = examples_total ; for ( pos_abs = 0 ; pos_abs < examples_total ; pos_abs ++ ) { alpha = alphas [ pos_abs ] ; if ( alpha > is_zero ) { if ( lambda ( pos_abs ) < max_lambda ) { max_lambda = lambda ( pos_abs ) ; max_pos = pos_abs ; } ; } ; } ; if ( max_pos < examples_total ) { if ( working_set_size < parameters_working_set_size ) { working_set_size ++ ; } ; working_set [ working_set_size - 1 ] = max_pos ; } ; } ; } ; if ( working_set_size < parameters_working_set_size && working_set_size < examples_total ) { pos = ( int ) ( Math . random ( ) * examples_total ) ; int ok ; while ( working_set_size < parameters_working_set_size && working_set_size < examples_total ) { ok = 1 ; for ( i = 0 ; i < working_set_size ; i ++ ) { if ( working_set [ i ] == pos ) { ok = 0 ; i = working_set_size ; } ; } ; if ( 1 == ok ) { working_set [ working_set_size ] = pos ; working_set_size ++ ; } ; pos = ( pos + 1 ) % examples_total ; } ; } ; }
calculates the working set
