Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] mhaco asserts if initial population does not verify constraints #525

Open
jschueller opened this issue Oct 25, 2022 · 4 comments
Open
Labels

Comments

@jschueller
Copy link
Contributor

jschueller commented Oct 25, 2022

if the initial population does not verify constraints (through unconstrain) mhaco asserts:

IndexError: 
function: assert_minimisation
where: /tmp/pagmo2-2.18.0/src/utils/hv_algos/hv_algorithm.cpp, 256
what: Reference point is invalid: another point seems to be outside the reference point boundary, or be equal to it:

kind of similar to #493

@jschueller jschueller added the bug label Oct 25, 2022
@jschueller
Copy link
Contributor Author

@Sceki do you mind looking at this one too ? its a bit similar, not on the bound constraints, but on the general eq/ineq constraints

@Sceki
Copy link
Member

Sceki commented Jul 29, 2024

@jschueller can you please post a minimal code to reproduce this error?

@jschueller
Copy link
Contributor Author

here:

#include <pagmo/algorithms/maco.hpp>
#include <pagmo/population.hpp>
#include <pagmo/problems/rosenbrock.hpp>
#include <pagmo/problems/unconstrain.hpp>

using namespace pagmo;

struct problem1 {
    vector_double fitness(const vector_double &x) const
    {
        const double g = 1.0 + 9.0 * (x[0] + x[1]);
        return {x[0], g * (1.0 - std::sqrt(x[0] / g)), x[1]-x[0]}; // zdt1 + constraint x0>x1
    }
    std::pair<vector_double, vector_double> get_bounds() const
    {
        return {{0.0, 0.0}, {1.0, 1.0}};
    }
    vector_double::size_type get_nobj() const
    {
        return 2;
    }
    
    vector_double::size_type get_nic() const
    {
        return 1;
    }
};

int main()
{
  try {
    problem prob{problem1{}};

    prob = unconstrain(prob);
    
    population pop1{prob, 0, 0};
    int size = 80;
    std::uniform_real_distribution<double> unif(0.0, 1.0);
    std::default_random_engine re;
    for (int i=0; i<size; ++i)
    {
      vector_double x(2);
      x[0] = unif(re);
      do {
        x[1] = unif(re);
      } while (false && x[0] <= x[1]);// ok if replace false by true
      
      vector_double y = prob.fitness(x);
      pop1.push_back(x);
    }

    maco user_algo1{10u};
    pop1 = user_algo1.evolve(pop1);

	}
	catch(const std::exception & exc) {
		std::cout << "ex="<<exc.what() <<std::endl;
		return 2;
	}
	return 0;
}

@jschueller
Copy link
Contributor Author

@Sceki were you able to reproduce using my code ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants