コード例 #1
0
  public double get_h_value(Vertex t) {
    ArrayList<Vertex> chems = G.getChemV();
    double ans = 0;
    double t_dis = (this.d).get_t_dis_in_dList(d_list, t.getIndex());

    int v_c_index;
    int v_index;
    double v_dis;
    double dis;

    for (int i = 0; i < chems.size(); i++) {
      // get the index of the vertex in chem ver
      v_c_index = (chems.get(i)).getIndex();
      // get the index of him in d_list
      v_index = (this.d).getIndexInList(this.d_list, v_c_index);
      // get his distance
      v_dis = ((this.d_list).get(v_index)).get_dis();
      // compute the distance between t and chems.get(i):
      dis = Math.abs(t_dis - v_dis);
      // inc the ans
      ans = ans + dis;
    }

    return ans * 2;
  }
コード例 #2
0
  public double get_f_value(Double H_value) {
    double ans = 0;

    ArrayList<Vertex> chems = G.getChemV();

    int v_c_index;
    int v_index;
    double v_dis;

    for (int i = 0; i < chems.size(); i++) {
      // get the index of the vertex in chem ver
      v_c_index = (chems.get(i)).getIndex();
      // get the index of him in d_list
      v_index = (this.d).getIndexInList(this.d_list, v_c_index);
      // get his distance
      v_dis = ((this.d_list).get(v_index)).get_dis();
      // we already know that d[s] = 0
      // therefore we only accumulate the d[v]
      ans = ans + v_dis;
    }
    return ans;
  }