001: /*
002: * This file is part of JGAP.
003: *
004: * JGAP offers a dual license model containing the LGPL as well as the MPL.
005: *
006: * For licensing information please see the file license.txt included with JGAP
007: * or have a look at the top of class org.jgap.Chromosome which representatively
008: * includes the JGAP license policy applicable for any file delivered with JGAP.
009: */
010: package org.jgap.distr.grid.gp;
011:
012: import org.homedns.dade.jcgrid.client.*;
013: import org.jgap.gp.impl.*;
014: import org.jgap.gp.*;
015:
016: /**
017: * Abstract base class for the important GP grid configuration. It holds any
018: * information necessary to describe a problem and the way it is solved
019: * distributedly.
020: *
021: * @author Klaus Meffert
022: * @since 3.2
023: */
024: public abstract class GridConfigurationGPBase implements
025: IGridConfigurationGP {
026: /** String containing the CVS revision. Read out via reflection!*/
027: private final static String CVS_REVISION = "$Revision: 1.4 $";
028:
029: private IClientFeedbackGP m_clientFeedback;
030:
031: private IRequestSplitStrategyGP m_splitStrategy;
032:
033: private GPConfiguration m_config;
034:
035: private IClientEvolveStrategyGP m_clientEvolveStrategy;
036:
037: private IWorkerEvolveStrategyGP m_workerEvolveStrategy;
038:
039: private IWorkerReturnStrategyGP m_workerReturnStrategy;
040:
041: private IGenotypeInitializerGP m_genotypeInitializer;
042:
043: private String m_packageName;
044:
045: private Class[] m_types;
046:
047: private Class[][] m_argTypes;
048:
049: private CommandGene[][] m_nodeSets;
050:
051: private int[] m_minDepths;
052:
053: private int[] m_maxDepths;
054:
055: private int m_maxNodes;
056:
057: public GridConfigurationGPBase() {
058: // m_packageName = getClass().getPackage().getName();
059: }
060:
061: public String getPackageName() {
062: return m_packageName;
063: }
064:
065: public IClientFeedbackGP getClientFeedback() {
066: return m_clientFeedback;
067: }
068:
069: public IClientEvolveStrategyGP getClientEvolveStrategy() {
070: return m_clientEvolveStrategy;
071: }
072:
073: public IRequestSplitStrategyGP getRequestSplitStrategy() {
074: return m_splitStrategy;
075: }
076:
077: public GPConfiguration getConfiguration() {
078: return m_config;
079: }
080:
081: public void setConfiguration(GPConfiguration a_config) {
082: m_config = a_config;
083: }
084:
085: public IWorkerEvolveStrategyGP getWorkerEvolveStrategy() {
086: return m_workerEvolveStrategy;
087: }
088:
089: public IWorkerReturnStrategyGP getWorkerReturnStrategy() {
090: return m_workerReturnStrategy;
091: }
092:
093: public IGenotypeInitializerGP getGenotypeInitializer() {
094: return m_genotypeInitializer;
095: }
096:
097: public void setGenotypeInitializer(
098: IGenotypeInitializerGP a_initializer) {
099: m_genotypeInitializer = a_initializer;
100: }
101:
102: public void setWorkerReturnStrategy(
103: IWorkerReturnStrategyGP a_strategy) {
104: m_workerReturnStrategy = a_strategy;
105: }
106:
107: public void setWorkerEvolveStrategy(
108: IWorkerEvolveStrategyGP a_strategy) {
109: m_workerEvolveStrategy = a_strategy;
110: }
111:
112: /**
113: * Write your initialization of the private attributes here!
114: *
115: * @param a_gridconfig current grid node client configuration (provided via
116: * the command line at startup)
117: * @throws Exception in case of any error
118: */
119: public abstract void initialize(GridNodeClientConfig a_gridconfig)
120: throws Exception;
121:
122: /**
123: * Called immediately before starting the grid computation. Verify here,
124: * if your configuration is setup properly and all fields are initialized
125: * correctly.
126: *
127: * @throws Exception
128: */
129: public abstract void validate() throws Exception;
130:
131: public void setClientEvolveStrategy(
132: IClientEvolveStrategyGP a_strategy) {
133: m_clientEvolveStrategy = a_strategy;
134: }
135:
136: public void setClientFeedback(IClientFeedbackGP a_clientFeedback) {
137: m_clientFeedback = a_clientFeedback;
138: }
139:
140: public void setRequestSplitStrategy(
141: IRequestSplitStrategyGP a_splitStrategy) {
142: m_splitStrategy = a_splitStrategy;
143: }
144:
145: public void setTypes(Class[] a_types) {
146: m_types = a_types;
147: }
148:
149: public void setArgTypes(Class[][] a_argTypes) {
150: m_argTypes = a_argTypes;
151: }
152:
153: public void setNodeSets(CommandGene[][] a_nodeSets) {
154: m_nodeSets = a_nodeSets;
155: }
156:
157: public void setMinDepths(int[] a_minDepths) {
158: m_minDepths = a_minDepths;
159: }
160:
161: public void setMaxDepths(int[] a_maxDepths) {
162: m_maxDepths = a_maxDepths;
163: }
164:
165: public void setMaxNodes(int a_maxNodes) {
166: m_maxNodes = a_maxNodes;
167: }
168:
169: public Class[] getTypes() {
170: return m_types;
171: }
172:
173: public Class[][] getArgTypes() {
174: return m_argTypes;
175: }
176:
177: public CommandGene[][] getNodeSets() {
178: return m_nodeSets;
179: }
180:
181: public int[] getMinDepths() {
182: return m_minDepths;
183: }
184:
185: public int[] getMaxDepths() {
186: return m_maxDepths;
187: }
188:
189: public int getMaxNodes() {
190: return m_maxNodes;
191: }
192: }
|