$darkmode
DENOPTIM
Isomorphism.java
Go to the documentation of this file.
1/*
2 * DENOPTIM
3 * Copyright (C) 2019 Marco Foscato <marco.foscato@uib.no>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as published
7 * by the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19package denoptim.programs.isomorphism;
20
21import java.io.File;
22import java.util.logging.Level;
23
24import denoptim.graph.DGraph;
25import denoptim.io.DenoptimIO;
26import denoptim.task.ProgramTask;
27
34public class Isomorphism extends ProgramTask
35{
36
37//------------------------------------------------------------------------------
38
44 public Isomorphism(File configFile, File workDir)
45 {
46 super(configFile,workDir);
47 }
48
49//------------------------------------------------------------------------------
50
51 @Override
52 public void runProgram() throws Throwable
53 {
55 isomParams.readParameterFile(configFilePathName.getAbsolutePath());
56 isomParams.checkParameters();
57 isomParams.processParameters();
58 isomParams.startProgramSpecificLogger(loggerIdentifier, false); //to STDOUT
59
60 DGraph graphA = null;
61 DGraph graphB = null;
62 try
63 {
65 new File(isomParams.inpFileGraphA)).get(0);
67 new File(isomParams.inpFileGraphB)).get(0);
68 } catch (Exception e)
69 {
70 e.printStackTrace();
71 }
72
73 isomParams.getLogger().log(Level.INFO,
74 "Checking for isomorphism between ");
75 isomParams.getLogger().log(Level.INFO, " -> GraphA: " + graphA);
76 isomParams.getLogger().log(Level.INFO, " -> GraphB: " + graphB);
77
78 if (graphA.isIsomorphicTo(graphB))
79 {
80 isomParams.getLogger().log(Level.INFO,
81 "Graphs are DENOPTIM-isomorphic!");
82 } else {
83 isomParams.getLogger().log(Level.INFO,
84 "No DENOPTIM-isomorphism found.");
85 }
86 }
87
88//------------------------------------------------------------------------------
89
90}
Container for the list of vertices and the edges that connect them.
Definition: DGraph.java:102
boolean isIsomorphicTo(DGraph other)
Checks if this graph is "DENOPTIM-isomorphic" to the other one given.
Definition: DGraph.java:3453
Utility methods for input/output.
static ArrayList< DGraph > readDENOPTIMGraphsFromFile(File inFile)
Reads a list of <DGraphs from file.
Logger startProgramSpecificLogger(String loggerIdentifier)
Starts a logger with the given name.
void readParameterFile(String infile)
Read the parameter TXT file line by line and interpret its content.
Logger getLogger()
Get the name of the program specific logger.
Tool to perform isomorphism analysis on DGraphs.
Isomorphism(File configFile, File workDir)
Creates and configures the program task.
Parameters controlling execution of Isomorphism main class.
void checkParameters()
Evaluate consistency of input parameters.
void processParameters()
Processes all parameters and initialize related objects.
Task structure for any of the main programs in the denoptim project, such as genetic algorithm and co...
String loggerIdentifier
Identifier of this program's logger.
File configFilePathName
File containing configuration parameters for the program task.
File workDir
The file system location where we want to be placed when doing the work.
Definition: Task.java:78