Example #1
0
 /**
  * * Kills a certain percentage of neurons in the network (recursively including subnetworks).
  *
  * @param killrate the percentage (0.0 to 1.0) of neurons to kill
  * @param saveRelays if true, exempt populations with only one node from the slaughter
  */
 public void killNeurons(float killrate, boolean saveRelays) {
   Node[] nodes = getNodes();
   for (Node node : nodes) {
     if (node instanceof NetworkImpl) {
       ((NetworkImpl) node).killNeurons(killrate, saveRelays);
     } else if (node instanceof NEFEnsembleImpl) {
       ((NEFEnsembleImpl) node).killNeurons(killrate, saveRelays);
     }
   }
 }
Example #2
0
  /** @see ca.nengo.model.Network#removeNode(java.lang.String) */
  public void removeNode(String name) throws StructuralException {
    if (myNodeMap.containsKey(name)) {
      Node node = myNodeMap.get(name);

      if (node instanceof Network) {
        Network net = (Network) node;
        Probe[] probes = net.getSimulator().getProbes();
        for (Probe probe : probes) {
          try {
            net.getSimulator().removeProbe(probe);
          } catch (SimulationException se) {
            System.err.println(se);
            return;
          }
        }

        Node[] nodes = net.getNodes();
        for (Node node2 : nodes) {
          net.removeNode(node2.getName());
        }
      } else if (node instanceof DecodableEnsembleImpl) {
        NEFEnsembleImpl pop = (NEFEnsembleImpl) node;
        Origin[] origins = pop.getOrigins();
        for (Origin origin : origins) {
          String exposedName = getExposedOriginName(origin);
          if (exposedName != null) {
            hideOrigin(exposedName);
          }
        }
      }

      myNodeMap.remove(name);
      node.removeChangeListener(this);
      //			VisiblyMutableUtils.nodeRemoved(this, node, myListeners);
    } else {
      throw new StructuralException("No Node named " + name + " in this Network");
    }

    getSimulator().initialize(this);
    fireVisibleChangeEvent();
  }
Example #3
0
  /** @param use Use GPU? */
  public void setUseGPU(boolean use) {
    // myUseGPU = use;

    Node[] nodes = getNodes();

    for (Node workingNode : nodes) {
      if (workingNode instanceof NEFEnsembleImpl) {
        ((NEFEnsembleImpl) workingNode).setUseGPU(use);
      } else if (workingNode instanceof NetworkImpl) {
        ((NetworkImpl) workingNode).setUseGPU(use);
      }
    }
  }