Пример #1
0
  public void print() throws IOException {

    /*BufferedWriter bw = new BufferedWriter(new FileWriter("out/salidaH.txt"));*/
    System.out.println("\n ---- CAPA OCULTA ----\n");
    // el for recorre todas las neuronas menos la ultima q es el bias
    for (int index = 0; index < this.neuronList.size() - 1; index++) {
      Neuron neuron = this.neuronList.get(index);
      System.out.println(
          "Neurona "
              + String.valueOf(index)
              + ": Entrada=>"
              + String.valueOf(neuron.getInput())
              + " || Salida: "
              + String.valueOf(neuron.getOutput())
              + "\n");
      List<Link> inputs = neuron.getInputs();
      for (int i = 0; i < inputs.size(); i++) {
        Link enlace = inputs.get(i);
        System.out.println(
            "                     Conexion => Valor: "
                + String.valueOf(enlace.getNeuron().getOutput())
                + " || Peso: "
                + String.valueOf(enlace.getWeight())
                + "\n");
      }
    }
    /*bw.append("Bias Capa Oculta: "+String.valueOf(this.bias.getInput()));
    bw.close();*/
  }
Пример #2
0
  /* increase the weight of a path */
  public synchronized void addTrip(List<Link> trip, Integer pheroneToAdd) {

    Float tripLenght = getPathLength(trip);

    for (Link link : trip) {
      Float newWeight = link.getWeight() + (pheroneToAdd / tripLenght);
      link.setWeight(newWeight);
    }
  }
Пример #3
0
 /* reduce the weight of all links */
 public void evaporation(Float ratio) {
   for (Link link : links) {
     link.setWeight(link.getWeight() * ratio);
   }
 }