Skip to content

Evaluating constraints leads to ArrayIndexOutOfBoundsException #4

@sherzig

Description

@sherzig

Hi,

I'm trying to perform a check on each solution to see whether a set of pre-defined OCL invariants are satisified. This is what I use in the search configuration:

constraints = { OCLStructuralConstraintViolation : minimize { val d = Diagnostician.INSTANCE.validate(MomotUtil.getRoot(solution.execute())); if (d.getChildren().size() > 0) { IFitnessDimension.CONSTRAINT_VIOLATED; } else { IFitnessDimension.CONSTRAINT_OK; } } }

The search runs fine for a few seconds, but then throws the following exception:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.ArrayList.elementData(ArrayList.java:418) at java.util.ArrayList.get(ArrayList.java:431) at org.moeaframework.algorithm.ReferencePointNondominatedSortingPopulation.associateToReferencePoint(ReferencePointNondominatedSortingPopulation.java:560) at org.moeaframework.algorithm.ReferencePointNondominatedSortingPopulation.truncate(ReferencePointNondominatedSortingPopulation.java:639) at org.moeaframework.algorithm.ReferencePointNondominatedSortingPopulation.truncate(ReferencePointNondominatedSortingPopulation.java:691) at org.moeaframework.algorithm.NSGAII.iterate(NSGAII.java:97) at org.moeaframework.algorithm.AbstractAlgorithm.step(AbstractAlgorithm.java:161) at org.moeaframework.algorithm.PeriodicAction.step(PeriodicAction.java:108) at at.ac.tuwien.big.moea.experiment.executor.SearchExecutor.runAlgorithm(SearchExecutor.java:269) at at.ac.tuwien.big.moea.experiment.executor.SearchExecutor.runSingleSeed(SearchExecutor.java:301) at org.moeaframework.Executor.runSeeds(Executor.java:608) at at.ac.tuwien.big.moea.SearchExperiment.run(SearchExperiment.java:254) at at.ac.tuwien.big.moea.SearchExperiment.run(SearchExperiment.java:241) at momot.search.search.performSearch(search.java:374) at momot.search.search.main(search.java:397)

Could this be due to the array only being sized for objectives, but not constraints and objectives?

Also, is there a way to mark something as a "hard" constraint - i.e., the candidate solution is thrown away if those constraints are not satisified?

Thanks,

Sebastian

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions