[EvA] Trouble with constraints
Fabian Becker
fabian.becker at uni-tuebingen.de
Wed Apr 25 19:26:48 CEST 2012
Hi Johannes,
can you send me the complete code you are using? I would like to do some
debugging on that issue.
One note upfront: EvA2Problem does not implement "getProblemDimension()"
which should prevent the class from compile at all.
Best regards,
Fabian
On 25.04.2012 18:02, Johannes wrote:
> Hello,
>
> 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
More information about the EvA
mailing list