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

Issue with running jGenprog with bug from defects4j #370

Open
Fibien opened this issue Mar 8, 2024 · 5 comments
Open

Issue with running jGenprog with bug from defects4j #370

Fibien opened this issue Mar 8, 2024 · 5 comments

Comments

@Fibien
Copy link

Fibien commented Mar 8, 2024

Hello, I’m currently a bit stuck with trying to use jGenprog to fix a bug from defects4j.

I have installed astor and successfully run the jGenprog example code from getting started. (With the following)

cd examples/Math-issue-280
mvn clean compile test -DskipTests # compiling and running bug example
cd ../../
java -cp target/astor-*-jar-with-dependencies.jar fr.inria.main.evolution.AstorMain -mode jgenprog -srcjavafolder /src/java/ -srctestfolder /src/test/ -binjavafolder /target/classes/ -bintestfolder /target/test-classes/ -location /home/user/astor/examples/Math-issue-280/ -dependencies examples/Math-issue-280/lib

I have also installed and successfully run the defects4j example. I have checked out, compiled and tested using the example code on their git.

Now to the problem. I have checked out and compiled bug 40 from Math in defects4j and stored the bug in /tmp/bug/40/ and when I try to run jGenprog using this the command below, I get following error:

Error: Could not find or load main class fr.inria.main.evolution.AstorMain

The command used
sudo java -cp /home/project/astor-*-jar-with-dependencies.jar fr.inria.main.evolution.AstorMain -mode jgenprog -srcjavafolder /src/java/ -srctestfolder /src/test/ -binjavafolder /target/classes/ -bintestfolder /target/test-classes/ -location /tmp/math/40 -stopfirst true

I have compiled the bug folder using the compile command in defects4j and mvn clean compile test -DskipTests. Have encountered the same error in both cases.

Does anyone know what might be the issue?
Any advice on how to extract bugs from defects4j and create and verify patches using jGenprog would be appreciated.

@monperrus
Copy link
Contributor

monperrus commented Mar 11, 2024 via email

@Fibien
Copy link
Author

Fibien commented Mar 11, 2024

Thank you, that was the issue.

Having read "Astor: Exploring the Design Space of Generate-and-Validate Program Repair beyond GenProg," I discovered that there were two implemented navigation strategies for jGenprog: selective and evolution. However, I couldn't find out how to select the evolution strategy as the navigation strategy for jGenprog, neither among the arguments provided here nor using help in the terminal. How does one select the evolution strategy as the navigation strategy for jGenprog?

While examining the implementation of jGenprog, I noticed there was a check to determine if the crossover operation should be applied. Should one change the setting in astor.properties (applyCrossover=true) to make jGenprog apply the crossover operator? Or what is the intended method to make jGenprog apply the crossover operator?

Thank you again for the help and the answers.

@monperrus
Copy link
Contributor

ping @martinezmatias

@martinezmatias
Copy link
Collaborator

martinezmatias commented Mar 12, 2024

Hi @Fibien

How does one select the evolution strategy as the navigation strategy for jGenprog?

You can implicitly select the strategy by considering more than program variant to evolve (i.e., the population). By default we use one. The population can be controlled with the param population. There are other propertiesfor the evolution strategy that can be configured (e.g. mutationrate).

Since in our experiments we have executed jGenProg in the selective mode (mostly for a matter of scalability), we dont have a clear interface for the evolutionary mode. For that reason, we have not played enough with the crossover functionality.

I open an issue to implement a clear interface for the two modes. Please, feel free to propose a PR of that implementation. (I don't have time for implement it right now, but I can help you).

Regards
Matias

@Fibien
Copy link
Author

Fibien commented Mar 12, 2024

Thank you for the answer Matias. Would invoking jGenprog with another value for population or mutationrate make jGenprog use evolution strategy and the crossover functionality?

Would it be possible to combine the selective strategy with the crossover functionality? For example by removing the conditional check in jGenprog and directly run ‘applyCrossover’? Would the crossover functionality work the same with selective navigation strategy as it would with evolutionary navigation strategy?

Thanks again for all the help.

@Fibien Fibien closed this as completed Mar 12, 2024
@Fibien Fibien reopened this Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants