Minimization Problem

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Minimization Problem

safak
Hi All,

How can I write a minimization problem using JGAP?

Thanks,

SAFAK
Reply | Threaded
Open this post in threaded view
|

Re: Minimization Problem

Guido Garcia Bernardo
Hi,

Could do please elaborate a little on your minimization problem?
It seems very easy to implement a FitnessFunction with an evaluate
method that returns better scores as your problem values are lower...

Something like (not tested) :

import org.jgap.FitnessFunction;
import org.jgap.IChromosome;

public class MyFitness extends FitnessFunction {
    MyFitness(){
    }

    public double evaluate(IChromosome a_subject) {
        int x = (Integer) a_subject.getGene(0).getAllele();
        double ret = 1 / x + 1;  // choose your minimization function
        return ret;
   }
}

Best regards,
Guido.

On Mon, Sep 15, 2008 at 10:36 PM, safak <[hidden email]> wrote:

>
> Hi All,
>
> How can I write a minimization problem using JGAP?
>
> Thanks,
>
> SAFAK
> --
> View this message in context: http://www.nabble.com/Minimization-Problem-tp19500604p19500604.html
> Sent from the jgap-users mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> jgap-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jgap-users
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jgap-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jgap-users
Reply | Threaded
Open this post in threaded view
|

Re: Minimization Problem

ShankhaB
Hi

I also try to solve some simple minimization problem with constraints. As you already discuss Minimization problem , let me present my case.

 I just want to know is the below mentioned type of problem can be soleved by JGAP if yes how can I write evaluate () function.
What I understood this is the most important area to justify my problem.

Problem :

Minimize Z = 2x1+ 8x2  
Subject To -   5x1+x2>=10  
                    2x1+2x2>=14
                    x1+4x2>=12
                    x1,x2>=0   and 1<x1<=7    |   0<x2<=4



What I understand I have to check the my Fitness function or objective function (Z) in the

public double evaluate(IChromosome a_subject)  method , where a_subject  is the one of the potential solution.

from the "a_subject"  object I have to get the value of X1 and X2 then , I have to chek all the above mentioned constraints as well as the Fitness function (Z).

But HOW this will be determined that for which IChromosome ( a_subject) - Z will be minimized ?

Please guide me?

Thank you,
shankha



<quote author="Guido Garcia Bernardo">
Hi,

Could do please elaborate a little on your minimization problem?
It seems very easy to implement a FitnessFunction with an evaluate
method that returns better scores as your problem values are lower...

Something like (not tested) :

import org.jgap.FitnessFunction;
import org.jgap.IChromosome;

public class MyFitness extends FitnessFunction {
    MyFitness(){
    }

    public double evaluate(IChromosome a_subject) {
        int x = (Integer) a_subject.getGene(0).getAllele();
        double ret = 1 / x + 1;  // choose your minimization function
        return ret;
   }
}

Best regards,
Guido.

On Mon, Sep 15, 2008 at 10:36 PM, safak <CSahin@gc.cuny.edu> wrote:
>
> Hi All,
>
> How can I write a minimization problem using JGAP?
>
> Thanks,
>
> SAFAK
> --
> View this message in context: http://www.nabble.com/Minimization-Problem-tp19500604p19500604.html
> Sent from the jgap-users mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> jgap-users mailing list
> jgap-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jgap-users
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jgap-users mailing list
jgap-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jgap-users