diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 0e696ae..17cd025 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -23,7 +23,7 @@ jobs: wget -nv -O knitro.tar.gz --user "$KNITRO_DOWNLOAD_USER" --password "$KNITRO_DOWNLOAD_PASSWORD" "$KNITRO_LINUX_URL" mkdir -p $RUNNER_TEMP/knitro tar xzf knitro.tar.gz -C $RUNNER_TEMP/knitro - echo "KNITRODIR=$RUNNER_TEMP/knitro/knitro-14.1.0-Linux64" >> "$GITHUB_ENV" + echo "KNITRODIR=$RUNNER_TEMP/knitro/knitro-14.2.0-Linux64" >> "$GITHUB_ENV" env: KNITRO_DOWNLOAD_USER: ${{ secrets.KNITRO_DOWNLOAD_USER }} KNITRO_DOWNLOAD_PASSWORD: ${{ secrets.KNITRO_DOWNLOAD_PASSWORD }} @@ -35,7 +35,7 @@ jobs: run: | C:\msys64\usr\bin\wget.exe -nv -O knitro.zip --user "$env:KNITRO_DOWNLOAD_USER" --password "$env:KNITRO_DOWNLOAD_PASSWORD" "$env:KNITRO_WINDOWS_URL" 7z x -y knitro.zip -oC:\knitro - echo "KNITRODIR=C:\knitro\knitro-14.1.0-Win64" >> "$env:GITHUB_ENV" + echo "KNITRODIR=C:\knitro\knitro-14.2.0-Win64" >> "$env:GITHUB_ENV" env: KNITRO_DOWNLOAD_USER: ${{ secrets.KNITRO_DOWNLOAD_USER }} KNITRO_DOWNLOAD_PASSWORD: ${{ secrets.KNITRO_DOWNLOAD_PASSWORD }} @@ -53,7 +53,7 @@ jobs: - name: Build with Maven (Ubuntu) if: matrix.os != 'windows-latest' run: | - ./mvnw install:install-file -Dfile="$KNITRODIR/examples/Java/lib/Knitro-Interfaces-2.5-KN_14.1.0.jar" -DgroupId=com.artelys -DartifactId=knitro-interfaces -Dversion=14.1.0 -Dpackaging=jar -DgeneratePom=true + ./mvnw install:install-file -Dfile="$KNITRODIR/examples/Java/lib/Knitro-Interfaces-2.5-KN_14.2.0.jar" -DgroupId=com.artelys -DartifactId=knitro-interfaces -Dversion=14.2.0 -Dpackaging=jar -DgeneratePom=true ./mvnw --batch-mode -Pjacoco install env: ARTELYS_LICENSE: ${{ secrets.ARTELYS_LICENSE }} @@ -61,7 +61,7 @@ jobs: - name: Build with Maven (Windows) if: matrix.os == 'windows-latest' run: | - call mvnw.cmd install:install-file -Dfile="%KNITRODIR%\examples\Java\lib\Knitro-Interfaces-2.5-KN_14.1.0.jar" -DgroupId=com.artelys -DartifactId=knitro-interfaces -Dversion=14.1.0 -Dpackaging=jar -DgeneratePom=true + call mvnw.cmd install:install-file -Dfile="%KNITRODIR%\examples\Java\lib\Knitro-Interfaces-2.5-KN_14.2.0.jar" -DgroupId=com.artelys -DartifactId=knitro-interfaces -Dversion=14.2.0 -Dpackaging=jar -DgeneratePom=true mvnw.cmd --batch-mode install shell: cmd env: diff --git a/.github/workflows/snapshot-ci.yml b/.github/workflows/snapshot-ci.yml index 0ad3a71..39fa147 100644 --- a/.github/workflows/snapshot-ci.yml +++ b/.github/workflows/snapshot-ci.yml @@ -23,7 +23,7 @@ jobs: wget -nv -O knitro.tar.gz --user "$KNITRO_DOWNLOAD_USER" --password "$KNITRO_DOWNLOAD_PASSWORD" "$KNITRO_LINUX_URL" mkdir -p $RUNNER_TEMP/knitro tar xzf knitro.tar.gz -C $RUNNER_TEMP/knitro - echo "KNITRODIR=$RUNNER_TEMP/knitro/knitro-14.1.0-Linux64" >> "$GITHUB_ENV" + echo "KNITRODIR=$RUNNER_TEMP/knitro/knitro-14.2.0-Linux64" >> "$GITHUB_ENV" env: KNITRO_DOWNLOAD_USER: ${{ secrets.KNITRO_DOWNLOAD_USER }} KNITRO_DOWNLOAD_PASSWORD: ${{ secrets.KNITRO_DOWNLOAD_PASSWORD }} @@ -35,7 +35,7 @@ jobs: run: | C:\msys64\usr\bin\wget.exe -nv -O knitro.zip --user "$env:KNITRO_DOWNLOAD_USER" --password "$env:KNITRO_DOWNLOAD_PASSWORD" "$env:KNITRO_WINDOWS_URL" 7z x -y knitro.zip -oC:\knitro - echo "KNITRODIR=C:\knitro\knitro-14.1.0-Win64" >> "$env:GITHUB_ENV" + echo "KNITRODIR=C:\knitro\knitro-14.2.0-Win64" >> "$env:GITHUB_ENV" env: KNITRO_DOWNLOAD_USER: ${{ secrets.KNITRO_DOWNLOAD_USER }} KNITRO_DOWNLOAD_PASSWORD: ${{ secrets.KNITRO_DOWNLOAD_PASSWORD }} @@ -110,7 +110,7 @@ jobs: - name: Build with Maven (Ubuntu) if: matrix.os != 'windows-latest' run: | - ./mvnw install:install-file -Dfile="$KNITRODIR/examples/Java/lib/Knitro-Interfaces-2.5-KN_14.1.0.jar" -DgroupId=com.artelys -DartifactId=knitro-interfaces -Dversion=14.1.0 -Dpackaging=jar -DgeneratePom=true + ./mvnw install:install-file -Dfile="$KNITRODIR/examples/Java/lib/Knitro-Interfaces-2.5-KN_14.2.0.jar" -DgroupId=com.artelys -DartifactId=knitro-interfaces -Dversion=14.2.0 -Dpackaging=jar -DgeneratePom=true ./mvnw --batch-mode -Pjacoco install env: ARTELYS_LICENSE: ${{ secrets.ARTELYS_LICENSE }} @@ -118,7 +118,7 @@ jobs: - name: Build with Maven (Windows) if: matrix.os == 'windows-latest' run: | - call mvnw.cmd install:install-file -Dfile="%KNITRODIR%\examples\Java\lib\Knitro-Interfaces-2.5-KN_14.1.0.jar" -DgroupId=com.artelys -DartifactId=knitro-interfaces -Dversion=14.1.0 -Dpackaging=jar -DgeneratePom=true + call mvnw.cmd install:install-file -Dfile="%KNITRODIR%\examples\Java\lib\Knitro-Interfaces-2.5-KN_14.2.0.jar" -DgroupId=com.artelys -DartifactId=knitro-interfaces -Dversion=14.2.0 -Dpackaging=jar -DgeneratePom=true mvnw.cmd --batch-mode install shell: cmd env: diff --git a/README.md b/README.md index db6e470..52a5d08 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ Knitro Java bindings require a private JAR file that must be installed locally, Use the following command: ```bash -./mvnw install:install-file -Dfile="$KNITRODIR/examples/Java/lib/Knitro-Interfaces-2.5-KN_14.1.0.jar" -DgroupId=com.artelys -DartifactId=knitro-interfaces -Dversion=14.1.0 -Dpackaging=jar -DgeneratePom=true +./mvnw install:install-file -Dfile="$KNITRODIR/examples/Java/lib/Knitro-Interfaces-2.5-KN_14.2.0.jar" -DgroupId=com.artelys -DartifactId=knitro-interfaces -Dversion=14.2.0 -Dpackaging=jar -DgeneratePom=true ``` ### Running a Load Flow with Knitro Solver diff --git a/pom.xml b/pom.xml index 11f9e83..112bf97 100644 --- a/pom.xml +++ b/pom.xml @@ -45,7 +45,7 @@ 17 6.6.0 1.14.1 - 14.1.0 + 14.2.0 0.7.0 diff --git a/src/main/java/com/powsybl/openloadflow/knitro/solver/KnitroSolver.java b/src/main/java/com/powsybl/openloadflow/knitro/solver/KnitroSolver.java index 680b853..37e98cc 100644 --- a/src/main/java/com/powsybl/openloadflow/knitro/solver/KnitroSolver.java +++ b/src/main/java/com/powsybl/openloadflow/knitro/solver/KnitroSolver.java @@ -535,27 +535,6 @@ private void setSolverParameters(KNSolver solver) throws KNException { solver.setParam(KNConstants.KN_PARAM_MAXIT, knitroParameters.getMaxIterations()); } - /** - * Temporary to workaround Knitro finalization issue - FIXME on Knitro v14.2 release which will have the proper fix - */ - @SuppressWarnings({"java:S1113", "java:S1874", "java:S5738"}) - public static class FinalizeSafeSolver extends KNSolver implements AutoCloseable { - - public FinalizeSafeSolver(KNBaseProblem problem) throws KNException { - super(problem); - } - - @Override - protected void finalize() { - // no-op. - } - - @Override - public void close() { - this.KNFree(); - } - } - @Override public AcSolverResult run(VoltageInitializer voltageInitializer, ReportNode reportNode) { int nbIter; @@ -569,7 +548,7 @@ public AcSolverResult run(VoltageInitializer voltageInitializer, ReportNode repo throw new PowsyblException("Exception while trying to build Knitro Problem", e); } - try (FinalizeSafeSolver solver = new FinalizeSafeSolver(instance)) { + try (KNSolver solver = new KNSolver(instance)) { // Initialize problem solver.initProblem();