jMetal / jMetal

jMetal: a framework for multi-objective optimization with metaheuristics

Home Page:https://jmetal.readthedocs.io/en/latest/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with generating Latex files for *.Wilcoxsonin.R in R folder generated from ZDTScalabilityIStudy class in jMetal 5.6,5.8 and 6 versions

eng-aomar opened this issue · comments

Hello,
As a result of running the class ZDTScalabilityIStudy, three folders are generated, one of them is the R folder which contains files with .R extension.
How can I plot those files:
image

Maybe @ajnebro could add a quick description in the jMetal documentation regarding the generated files and how to exploit them.

Hi.
The R programs must be executed with R using the Rscript command:

Rscript EP.Boxplot.R

In the case of the files with including "Boxplot" you will obtain an eps file (as the EP.Boxplot.eps that appears in your screen capture); in the case of those with the "Wilcoxon" string you will get a Latex file.

If you are working with Linux or MacOS you can open a terminal and just type:

for i in *R; do Rscript $i ; done

About the Latex files, you can execute:

for i in *.tex ; do pdflatex $i ; done

Hi.
The R programs must be executed with R using the Rscript command:
Rscript EP.Boxplot.R
In the case of the files with including "Boxplot" you will obtain an eps file (as the EP.Boxplot.eps that appears in your screen capture); in the case of those with the "Wilcoxon" string you will get a Latex file.
If you are working with Linux or MacOS you can open a terminal and just type:
for i in *R; do Rscript $i ; done

About the Latex files, you can execute:
for i in *.tex ; do pdflatex $i ; done

Dear @ajnebro,
Using The command
for i in *R; do Rscript $i ; done,
I could generate the .esp files and then plot the Boxplot diagrams, but the latex didn't show up, please take a look
image

image

What is the problem with the latex files?

Thank you.

There was a bug in the generation of the Latex files and the directory was not correctly written, but it should be already fixed.

Are you using the last development version in GitHub?

@ajnebro I am working on jMetal 6, I will try to downgrade to the stable version is 5.8 .

The bug was not corrected in version 5.8 but in 6.0-SNAPSHOT. Please, try to use the last version in GitHub and, if the problem persists, let me know.

@ajnebro ok, I will get the latest version and check.
Thank you

@ajnebro After updating to jmetal 6.0-snapshot, the project build failed from Eclipse

image

But from the command line it succeeded, which is very strange?
image

@momah do you have any idea?

commented

Hello,
I don't think the problem is the jMetal version.
I suppose you use RStudio, so after installing R and Rstudio (latest stable version of both), try these steps (performed with the jMetal latest version)

  1. Locate your R path installation
    image

  2. set the R environment variables on windows

image

  1. RStudio -> Terminal (No Console)
    Execute the commands proposed by @ajnebro,

image

  1. eps files are generated

image

  1. install eps viewer from here:
    https://epsviewer.org/download.aspx

image

@momah The problem now is that after I updated the version of jmetal to the latest version 6.0 SNAPSHOT, I can't run use jmetal from eclipse, as in the picture below
image

I tried everything, I reinstalled eclipse to the latest version, maven, and started everything from scratch
but the problem is still there, also the project builds successfully using git bash.
What is the problem? I have no idea what to do to get things to work like before.

commented

Try with older commit of jMetal version 6.0, this one for example :
https://github.com/jMetal/jMetal/tree/ea8cfe165ed6b4d2b7c2bf1a3a5d5e748e0d02ed

follow this steps (Issue link : https://github.com/jMetal/jMetalDocumentation/issues/10)

Try with older commit of jMetal version 6.0, this one for example :
https://github.com/jMetal/jMetal/tree/ea8cfe165ed6b4d2b7c2bf1a3a5d5e748e0d02ed
follow this steps (Issue link : jMetal/jMetalDocumentation#10)

@momah I downgraded to 5.6 which it seems stable, and it worked

@eng-aomar You show that you have there is errors in your Eclipse, but you don't show the errors themselves. I just retrieved the current master version of jMetal, and in my case it does not work because I don't have JDK 10 (I think that upgrading the JDK was a bad move, since JDK 8 is still broadly in use, but that is not the topic). Could you please share what are your specific errors, so we can better understand what is blocking you?

For the sake of completeness, after installing JDK 11 I have no error.

If you can compile out of Eclipse but not inside, I would not be surprised if you just missed to do a refresh & Maven update in Eclipse (select projects + F5 for refresh, then Alt+F5 for Maven update).

@eng-aomar You show that you have there is errors in your Eclipse, but you don't show the errors themselves. I just retrieved the current master version of jMetal, and in my case it does not work because I don't have JDK 10 (I think that upgrading the JDK was a bad move, since JDK 8 is still broadly in use, but that is not the topic). Could you please share what are your specific errors, so we can better understand what is blocking you?
@matthieu-vergne
Regarding the IDK. Actually, eclipse install the jdk 11 as a bundle
I did not forget to refresh and update maven, this is a picture that shows the errors
image

Could you please give the results of the following git commands:

git status
git branch -a

Then could you please, in Eclipse, click on the menu Help > About Eclipse IDE and provide the information there?

I will install the same version and see what I have.

I reproduce the problem.

It seems to be an Eclipse issue, since you can fix it within Eclipse (by expliciting the generics) and if you revert your change (make it implicit again) the error does not come back. However, if you clean the project, the error does come back.

At the same time, it seems to be specific to jMetal, since I have tried importing several other projects and none of them had these errors. Including Maven projects with generics and submodules.

I am still investigating the issue.

It appears to be a regression in Eclipse.

I usually code on Eclipse Photon (4.8), and doing a clean on this one does not generate the errors. I have tried with a fresh install and as soon as I import the project and add the JDK 11 (to cover the JDK 10+ requirements) everything compile in Eclipse as usual. I have tried this with Eclipse 2020-03 (4.15) and 2019-12 (4.14) but both show the issue.

@eng-aomar For now, you can install Eclipse Photon if it is OK with you. I am currently trying to figure out which version starts to have the issue and I will update on that.

What I could try:

  • Eclipse 4.8 (Photon) compiles
  • Eclipse 4.9 (2018-09) compiles, although the builder failed before I add JDK 11
  • Eclipse 4.10 (2018-12) produces an internal compiler error (NPE), so just don't use it at all
  • Eclipse 4.11 (2019-03) produces an internal compiler error (NPE), so just don't use it at all
  • Eclipse 4.12 (2019-06) compile with some classpath errors, a Maven update generate the issue described here, a clean on the projects generate other errors, and a new Maven update generate an internal compiler error (NPE), so just don't use it at all
  • Eclipse 4.13 (2019-09) generate the issue
  • Eclipse 4.14 (2019-12) generate the issue
  • Eclipse 4.15 (2020-03) generate the issue

As a conclusion, jMetal seems to be usable only until Eclipse 4.9 (2018-09), which is quite old. Since I cannot reproduce this behaviour with other projects, it might be related to a problem within jMetal. I will try to investigate whether this is related to the JDK update.

@matthieu-vergne Thank you for your interest and follow-up.
@ajnebro
The problem now is with the *.Wilcoxon.R Found in the R folder, the script contains a bug, and this bug is found in every jmetal version including 5.6, I tried to solve it by I didn't succeed. do you have any idea

This is part of the EP.Wilcoxon.R , Please, note that in line 94, 108,109 there is an extra ), besides the directory is wrong, so all the *.Wilcoxon.R files, can you help with that.
image

I figured the bug and a potential fix for it.

Could you please use the last Eclipse version (4.15) and the last jMetal version (master) and change this line in the jMetal/pom.xml:

             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <version>3.8.0</version>
                 <configuration>
-                    <release>10</release>  <!--or <release>10</release>-->
+                    <release>11</release>
                 </configuration>
                 <dependencies>
                     <dependency>
                         <groupId>org.ow2.asm</groupId>
                         <artifactId>asm</artifactId>
                         <version>6.2</version> <!-- Use newer version of ASM -->
                     </dependency>
                 </dependencies>
             </plugin>

Then do a Maven update and everything should compile.

If it works, I will make a pull request for this fix.

If it works, I will make a pull request for this fix.

could you please send me a direct link for the eclipse v4.15

Just take the last version on the website:
https://www.eclipse.org/downloads/packages/

I tend to download directly the "Eclipse IDE for Java Developers" rather than using the installer.

@matthieu-vergne I fix the release number in jmetal 6 version, and it works on the current eclipse version, there is no need to download eclipse v4.16. BUT, the version jmetal 6.0- SNAPSHOT is not stable, the ZDTScalabilityIStudy runtime contains errors:
@ajnebro

  1. setReferenceFrontDirectory("/pareto_fronts") is set to the wrong path.
  2. when fixing the path to the right one .setReferenceFrontDirectory("../resources/referenceFronts")
    There is a problem still, please see the picture:

image

As a result, I still cannot plot the *.Wilcoxon.R found at the folder R, please help me by fixing the script.

I fix the release number in jmetal 6 version, and it works on the current eclipse version, there is no need to download eclipse v4.16

As far as I know, there is no 4.16 release, the last one being Eclipse 4.15 (2020-03). So that is fine.

For the runtime issues, I will let @ajnebro answer.

I fix the release number in jmetal 6 version, and it works on the current eclipse version, there is no need to download eclipse v4.16

As far as I know, there is no 4.16 release, the last one being Eclipse 4.15 (2020-03). So that is fine.
For the runtime issues, I will let @ajnebro answer.

@matthieu-vergne Thank you, you did a great job.

Hi.
The ZDTStudy program should work know, including the generated R scripts and Latex files.

Please, note that we are assuming by default that the files containing fronts are in CSV format. The directory containing the reference fronts is resources/referenceFrontsCSV.

Hi.
The ZDTStudy program should work know, including the generated R scripts and Latex files.
Please, note that we are assuming by default that the files containing fronts are in CSV format. The directory containing the reference fronts is resources/referenceFrontsCSV.

Dear @ajnebro
I get the latest version as in the picture:
image

And rerun the code, but there is still a run time error

image

Thank you.

Just set the working directory to the root of the jMetal project.

commented

maybe ??

.setReferenceFrontDirectory("../resources/referenceFrontsCSV")

anyway whenever you want to locate the directory where it is running you main program, set this code in the main method of your mainProgram (ZDTScalabilityIStudy in this case)

String current = new java.io.File( "." ).getCanonicalPath();
System.out.println("Current dir:"+current);
String currentDir = System.getProperty("user.dir");
System.out.println("Current dir using System:" +currentDir);

Just set the working directory to the root of the jMetal project.

@ajnebro well done, everything worked perfectly
image

maybe ??
.setReferenceFrontDirectory("../resources/referenceFrontsCSV")
anyway whenever you want to locate the directory where it is running you main program, set this code in the main method of your mainProgram (ZDTScalabilityIStudy in this case)
String current = new java.io.File( "." ).getCanonicalPath();
System.out.println("Current dir:"+current);
String currentDir = System.getProperty("user.dir");
System.out.println("Current dir using System:" +currentDir);

@momah the set work directory option worked perfectly

\{^o^}/