/* ZZSOM1.java * * Copyright (c) 2000, Ted Nelson and Tuomas Lukka * * You may use and distribute under the terms of either the GNU Lesser * General Public License, either version 2 of the license or, * at your choice, any later version. Alternatively, you may use and * distribute under the terms of the XPL. * * See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of * the licenses. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the README * file for more details. * */ /* * Written by Kimmo Wideroos */ package org.gzigzag.map; import org.gzigzag.*; import java.util.*; public class ZZSOM1 extends ZZMap implements ZOb { STRUCTPARAMS { int w = 9; int h = 9; ZOb inputReader = new DefaultInputReader(); } protected float[][] grid; protected int[] weightToCenter; protected SOM1.SquareLattice l; protected SOM1 s; protected boolean changed = true; protected int[] input_positions = null; public void initGrid(int w, int h) { for(int i=0; i p2.priority()) return p1; if(p2.priority() > p1.priority()) return p2; // if priorities are the same, test which one // match better with the weights if(weights[p1.id()] > weights[p2.id()]) return p1; return p2; } synchronized public boolean iterate() { if(inputs == null) return false; //for(int i=0; i