6. ADDING PROBLEMS INTO JGDS v3.5 CLASSES

 

        The JGDS classes have inside the implementation of two types of problems: RND and SAT problem. But perhaps, it could be interesting to add another types of problems. It is possible to do. In the class diagram, we can locate that RND and SAT classes are subclass of the Problem class:

         We have to create a new subclass of Problem that contains our new problem implementation:

        Then, we must modify the configuration and the Island.java file. The first one because we have to introduce the possibility of a new problem type, and perhaps the new problem has parameters that need to be configured by the user. The second one because if the configuration file changes, the configuration file read has to change too. Then, depending on the type of problem read, we do :

         File Island.java

....
830 if (PROBLEM_TYPE==SAT)

831    problem=new SAT ( LIT_IN_CLAUSULE,NUM_CLAUSULES,NUM_LITERALS);

832 else
833    {if (PROBLEM_TYPE==RND)

834       problem=new RND(SIDE_LENGTH,                           CELLS_OF_TRANS,BITS_PER_COORD,GENE_LENGTH);

835     else
836       problem=new New_problem(arguments…..); }
....

        In the next sections we will see how to introduce a new problem. In this case, it is a new implementation of RND problem. We will show what changes we have to introduce, in the original classes, to substitute the RND problem for the RND2 problem (so that, we minimize the changes produced).

 

 

 

[Previous][Index][Home][Next]