Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OKBJavaConnector/ECJClient/src/ec/spatial/Space.java @ 12147

Last change on this file since 12147 was 6152, checked in by bfarka, 14 years ago

added ecj and custom statistics to communicate with the okb services #1441

File size: 2.4 KB
Line 
1/*
2  Copyright 2006 by Sean Luke and George Mason University
3  Licensed under the Academic Free License version 3.0
4  See the file "LICENSE" for more information
5*/
6
7package ec.spatial;
8
9import ec.*;
10
11/*
12 * Space.java
13 *
14 * By: Liviu Panait
15 */
16
17
18/**
19 *      In a spatially-embedded EA, the subpopulations of individuals are assumed to be
20 *      spatially distributed in some sort of space, be it one-dimmensional, two-
21 *      dimmensional, or whatever else.  The space may or may not be toroidal (although
22 *      it usually is).  Each location in the space has a set of neighboring locations.
23 *      Thus, each individual has an index in the subpopulation, and also a location in
24 *      the space.
25 *
26 *      This public interface provides a method to obtain the indexes of the neighbors
27 *      of a location.
28 *
29 *
30 *
31 *
32 * @author Liviu Panait
33 * @version 1.0
34 */
35
36public interface Space
37    {
38    /*
39      The Space should provide a bijectional mapping from locations in space
40      to indexes in the subpopulation.  Returns -1 if error occured.
41    */
42    // public int locationToIndex( final Object location );
43
44    /*
45      The Space provide a bijectional mapping from indexes in the subpopulation
46      to locations in space.  Returns null if error occured.
47    */
48    // public Object indexToLocation( final int index);
49
50    /**
51       Input: a threadnumber (either for evaluation or for breeding), and an index in a subpopulation
52       (the index in the subpopulation is, of course, associated with a location in the space)
53       Functionality: stores the index and the threadnumber for further accesses to the getIndexRandomNeighbor
54       method.  All such accesses from the specific thread will use the exact same index, until
55       this function is called again to change the index.
56    */
57    public void setIndex( int threadnum, int index );
58
59    /**
60       Functionality: retrieve the index for a specific threanum.
61       Returns -1 if any error is encountered.
62    */
63    public int getIndex( int threadnum );
64
65    /**
66       Input: the maximum distance for neighbors.
67       Functionality: computes the location in space associated with the index, then
68       computes the neighbors of that location that are within the specified distance.
69       Output: returns one random neighbor within that distance (possibly including self)
70    */
71    public int getIndexRandomNeighbor( final EvolutionState state, int threadnum, int distance );
72
73    }
Note: See TracBrowser for help on using the repository browser.