[EvA] Trouble with constraints

Johannes adhocrocker at gmail.com
Wed Apr 25 18:02:54 CEST 2012


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)};
	}
}


More information about the EvA mailing list