[EvA] Trouble with constraints

Johannes adhocrocker at gmail.com
Fri Apr 27 11:18:50 CEST 2012


Hi Marcel,

thanks, for some of the variables hard constraints are indeed needed.
For some of the others, the "soft" ones are better.
Random was chosen purely for testing, with this solver I got the "value out
of bounds exception" for my equation the quickest :)

Regards

Johannes

2012/4/26 M.Kronfeld <makron at gmx.de>:
> Hi there,
>
> in EvA2, the prime mechanism for such a case would be to implement an
> own problem range. Just override
>        double getRangeLowerBound(int dim)
> and
>        double getRangeUpperBound(int dim)
> within your problem class to return the desired min/max values (e.g 0 or
> 1 in the first two dimensions and 0/max_value above). Doing that,
> negative values will not even be regarded in the first place.
>
> If you use the constraint mechanism, you are probably using soft
> constraints by default, meaning that negative values are allowed, but
> positive values are preferred with a certain weight (which can be
> parameterized somehow I assume).
>
> And by the way, I would not use random search for any plausible goal
> except proving that random search wont work ;)
>
> Best regards,
>  Marcel
>
>
> On 04/25/2012 06:02 PM, Johannes wrote:
>> > I want to solve a rather simple problem with the EvA2 toolbox
>> > using the Java interface.
>> > Unfortunately I cannot get the constraints to work as they should,
>> > I set them up, but they do not seem to be respected by the solver.
>> >
>> > If I did not misunderstand something fundamental on the issue, they
>> > are supposed to work like shown below. Still, I get results containing
>> > negative values, which should not be the case.
>> > Any hints are appreciated.
>> >
>> > Best regards
>> >
>> > Johannes
>> >
>> > I run this:
>> >
>> > double[] lösung =
>> > OptimizerFactory.optimizeToDouble(OptimizerFactory.RANDOM, new
>> > EvA2Problem10(zielfunktion));
>> >
>> > with this class:
>> >
>> > public abstract class EvA2Problem extends AbstractProblemDouble {
>> >
>> >     protected static final long serialVersionUID = 7005447722364059112L;
>> >     protected Abweichung abweichung;
>> >
>> >     public EvA2Problem(Abweichung abweichung)
>> >     {
>> >             this.abweichung = abweichung;
>> >             setWithConstraints(true);
>> >             setDefaultRange(10.0);
>> >             setConstraints(new AbstractConstraint[]{
>> >                             new IntervalConstraint(0, 0.0, 1.0),
>> >                             new IntervalConstraint(1, 0.0, 1.0),
>> >                             new IntervalConstraint(2, 0.0, Double.MAX_VALUE),
>> >                             new IntervalConstraint(3, 0.0, Double.MAX_VALUE),
>> >                             new IntervalConstraint(4, 0.0, Double.MAX_VALUE),
>> >                             new IntervalConstraint(5, 0.0, Double.MAX_VALUE),
>> >                             new IntervalConstraint(6, 0.0, Double.MAX_VALUE),
>> >                             new IntervalConstraint(7, 0.0, Double.MAX_VALUE),
>> >                             new IntervalConstraint(8, 0.0, Double.MAX_VALUE),
>> >                             new IntervalConstraint(9, 0.0, Double.MAX_VALUE)
>> >             });
>> >     }
>> >
>> >     @Override
>> >     public double[] eval(double[] values) {
>> >             return new double[]{abweichung.value(values)};
>> >     }
>> > }
>> > _______________________________________________
>> > EvA mailing list
>> > EvA at listserv.uni-tuebingen.de
>> > https://listserv.uni-tuebingen.de/mailman/listinfo/eva
>> >
> _______________________________________________
> EvA mailing list
> EvA at listserv.uni-tuebingen.de
> https://listserv.uni-tuebingen.de/mailman/listinfo/eva


More information about the EvA mailing list