Hipparchus-Math / hipparchus

An efficient, general-purpose mathematics components library in the Java programming language
Apache License 2.0
143 stars 42 forks source link

Infinite loop with SQPOptimizerGM #313

Open Serrof opened 8 months ago

Serrof commented 8 months ago

Solver can get stuck. This is due to rhoSegnato being Infinite, leading rho to be NaN and the while line 163 to loop infinitely.

Code sample to reproduce:

        final QuadraticFunction q = new QuadraticFunction(new double[][] { { 1.0, 0.0 }, { 0.0, 1.0 } },
                new double[] { 1.0, 0.0 },
                0.0);

        final LinearEqualityConstraint eqc = new LinearEqualityConstraint(new double[][] { { 1.0, 0.0 } },
                new double[] { 0.0 });

        final ConstraintOptimizer optimizer = buildOptimizer();
        final OptimizationData[] data = new OptimizationData[] { new ObjectiveFunction(q), eqc };
        final LagrangeSolution    solution  = optimizer.optimize(data);
roccafrancesco commented 8 months ago

Could you try to change the EPS of SQPOption putting the same value of ADMMOption?