19package denoptim.programs.genetweeker;
21import java.lang.reflect.Field;
22import java.util.ArrayList;
25import denoptim.exception.DENOPTIMException;
26import denoptim.files.FileUtils;
27import denoptim.programs.RunTimeParameters;
28import denoptim.programs.denovo.GAParameters;
29import denoptim.utils.CrossoverType;
30import denoptim.utils.MutationType;
44 protected enum Operator {MUTATION,XOVER,CROSSOVER}
171 switch (key.toUpperCase())
182 case "MUTATIONTARGET=":
184 String[] parts = value.split(
",");
186 for (
int i=0; i<parts.length; i++)
192 case "APIDONTARGETVERTEX=":
195 case "MUTATIONTYPE=":
198 case "NEWVERTEXMOLID=":
202 idNewAP = Integer.parseInt(value);
210 case "INPFILEFEMALE=":
215 String[] parts = value.split(
",");
217 for (
int i=0; i<parts.length; i++)
223 case "SUBGRAPHENDMALE=":
225 String[] parts = value.split(
",");
226 int[] idList =
new int[parts.length];
227 for (
int i=0; i<parts.length; i++)
229 idList[i] = Integer.parseInt(parts[i].trim());
234 case "SUBGRAPHENDFEMALE=":
236 String[] parts = value.split(
",");
237 int[] idList =
new int[parts.length];
238 for (
int i=0; i<parts.length; i++)
240 idList[i] = Integer.parseInt(parts[i].trim());
246 mapid = Integer.parseInt(value);
251 case "CROSSOVERTYPE=":
254 case "VERTEXFEMALE=":
256 String[] parts = value.split(
",");
258 for (
int i=0; i<parts.length; i++)
265 fapid = Integer.parseInt(value);
270 case "OUTFILEFEMALE=":
274 msg =
"Keyword " + key +
" is not a known TestOperator-"
275 +
"related keyword. Check input files.";
292 msg =
"Directory " +
workDir +
" not found. Please specify an "
293 +
"existing directory.";
299 msg =
"Input file '" +
inpFileM +
"' not found.";
306 msg =
"Input file '" +
inpFileF +
"' not found.";
340 StringBuilder sb =
new StringBuilder(1024);
342 for (Field f : this.getClass().getDeclaredFields())
346 sb.append(f.getName()).append(
" = ").append(
347 f.get(
this)).append(
NL);
352 +
" parameters. Cause: " + t);
358 sb.append(otherCollector.getPrintedList());
360 return sb.toString();
static boolean checkExists(String fileName)
Collection of parameters controlling the behavior of the software.
Map< ParametersType, RunTimeParameters > otherParameters
Collection of other parameters by type.
boolean containsParameters(ParametersType type)
void setParameters(RunTimeParameters otherParams)
String paramTypeName()
Returns a string defining the type the parameters collected here.
void checkOtherParameters()
Checks any of the parameter collections contained in this instance.
String workDir
Working directory.
final String NL
New line character.
void processOtherParameters()
Processes any of the parameter collections contained in this instance.
Parameters for genetic algorithm.
Parameters controlling execution of TestOperator.
List< int[]> xoverSubGraphEndFemale
Female VertedID (not index) that represent the end of the subgraph that is swapped by crossover.
List< int[]> xoverSubGraphEndMale
Male VertedID (not index) that represent the end of the subgraph that is swapped by crossover.
String outFileF
Output file female.
CrossoverType xoverType
Type of crossover to perform.
int[] xoverSrcFemale
Female VertexID (not index) on which perform xover.
int idNewAP
The given attachment point index.
int fapid
Female AP index on which perform xover.
int idTargetAP
Target attachment point ID for mutation (AP belonging already to the graph).
int mapid
Male AP index on which perform xover.
String inpFileM
Input File male.
void checkParameters()
Evaluate consistency of input parameters.
void processParameters()
Processes all parameters and initialize related objects.
MutationType mutationType
Type of mutation to perform.
String inpFileF
Input File female.
int[] xoverSrcMale
Male VertedID (not index) on which perform xover.
String outFileM
Output file male.
void interpretKeyword(String key, String value)
Processes a keyword/value pair and assign the related parameters.
int idNewVrt
The given vertex index.
GeneOpsRunnerParameters()
Constructor.
int maxSwappableChainLength
Maximum length of the subgraph that is swapped in a crossover operation.
int[] mutationTarget
Target vertex ID for mutation.
Operator operatorToTest
Chosen operator.
String getPrintedList()
Returns the list of parameters in a string with newline characters as delimiters.
Identifier of the type of parameters.
GO_PARAMS
Parameters controlling stand-alone run of genetic operators.
GA_PARAMS
Parameters pertaining the genetic algorithm.
Types of crossover defined.
BRANCH
Swaps the entire branch starting from a given vertex.
Types of mutation defined in relation to what happens to the target vertex (i.e., the actual mutation...