Menu

Optimize other applications and configuring modules

Mert Oguz
2016-02-03
2016-02-04
  • Mert Oguz

    Mert Oguz - 2016-02-03

    Hi,

    I would like to optimize my application using Opt4J as a library. I have read the tutorial and created Creator,Decoder,Evaluator classes and a Module class.

    Like in shown at the end of the tutorial, I created an Opt4J task and gave it my module. However I am getting runtime error with exception messages:

    1) No implementation for java.lang.Integer annotated with @org.opt4j.core.optimizer.MaxIterations() was bound.
    2) No implementation for org.opt4j.core.optimizer.IterativeOptimizer was bound.

    I tried to add an annotated integer in my Main class or in my Module class, however it didn't help.
    @MaxIterations int iterations = 1000;

    How can I overcome this problem?

    Another thing is, I didn't really get the DTLZModule in the tutorial. Is it a standard module? Could you explain the necessary configuration of user-defined modules a bit more?

    Thanks a lot,
    Mert

     
  • Martin Lukasiewycz

    Hi Mert,
    can you post the code how the cost looks like the fills the Opt4J task and starts it.

    Regarind the DTLZModule, you should have a look at the javadocs which you will find under documentation on the opt4j website.

    Best,
    Martin

     
  • Felix Reimann

    Felix Reimann - 2016-02-03

    Hi Mert,

    is it possible that you just added your ProblemModule to the Opt4JTask, as described in the tutorial Section 4 but did not add the EvolutionaryAlgorithmModule (or another OptimizerModule)? The exception says, that no optimizer can be found in your Opt4JTask setup.

    Best regards,
    Felix

     
  • Mert Oguz

    Mert Oguz - 2016-02-04

    Hi Felix and Martin,

    Thanks a lot for your answers. Apparently I didn't add an optimizer module as you said, now the problem is solved.

    • My new question is, I'd like to give a list of custom objects, which genotypes derive from, to the Creator class as a parameter. How can I achieve that? In my application, I will call the optimization function many times in runtime by pressing a button. And each time, possibly the candidate list will be changed.

    • I am trying to find the optimal subset among a list of objects based on some scores. The length of the optimal subset may vary. Do you think using SelectGenotype<P> will do the job? Or do you have any suggestions regarding Genotype's ?

    Best,
    Mert

     
  • Martin Lukasiewycz

    First question: You can create a class called Data that contains a list with the objects, etc. Then you can create an instance of it with all the required objects inside. Write a module where you bind Data to the specific instance (see Google Guice how to bind to an instance). Then you can inject this Data object in the constructor of the Creator.

    Second question: Sounds to me like a http://opt4j.sourceforge.net/javadoc/3.0.1/org/opt4j/core/genotype/BooleanMapGenotype.html would be more usefull.

    Best,
    Martin

     

Log in to post a comment.