Skip to content

Commit ca2793a

Browse files
committed
bump dependency versions
1 parent a2aed8a commit ca2793a

File tree

11 files changed

+45
-37
lines changed

11 files changed

+45
-37
lines changed

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#
1616

1717
groovy3Version=3.0.12
18-
groovy4Version=4.0.4
18+
groovy4Version=4.0.6
1919
chocoVersion=4.10.9
2020
jacopVersion=4.8.0
2121
ortoolsVersion=9.4.1874

gradle/wrapper/gradle-wrapper.jar

935 Bytes
Binary file not shown.
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

+6
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,12 @@ set -- \
205205
org.gradle.wrapper.GradleWrapperMain \
206206
"$@"
207207

208+
# Stop when "xargs" is not available.
209+
if ! command -v xargs >/dev/null 2>&1
210+
then
211+
die "xargs is not available"
212+
fi
213+
208214
# Use "xargs" to parse quoted args.
209215
#
210216
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.

gradlew.bat

+8-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@rem limitations under the License.
1515
@rem
1616

17-
@if "%DEBUG%" == "" @echo off
17+
@if "%DEBUG%"=="" @echo off
1818
@rem ##########################################################################
1919
@rem
2020
@rem Gradle startup script for Windows
@@ -25,7 +25,7 @@
2525
if "%OS%"=="Windows_NT" setlocal
2626

2727
set DIRNAME=%~dp0
28-
if "%DIRNAME%" == "" set DIRNAME=.
28+
if "%DIRNAME%"=="" set DIRNAME=.
2929
set APP_BASE_NAME=%~n0
3030
set APP_HOME=%DIRNAME%
3131

@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
4040

4141
set JAVA_EXE=java.exe
4242
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto execute
43+
if %ERRORLEVEL% equ 0 goto execute
4444

4545
echo.
4646
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
7575

7676
:end
7777
@rem End local scope for the variables with windows NT shell
78-
if "%ERRORLEVEL%"=="0" goto mainEnd
78+
if %ERRORLEVEL% equ 0 goto mainEnd
7979

8080
:fail
8181
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
8282
rem the _cmd.exe /c_ return code!
83-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84-
exit /b 1
83+
set EXIT_CODE=%ERRORLEVEL%
84+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
85+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
86+
exit /b %EXIT_CODE%
8587

8688
:mainEnd
8789
if "%OS%"=="Windows_NT" endlocal

subprojects/Diet/Diet.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dependencies {
2424
implementation "org.choco-solver:choco-solver:$chocoVersion"
2525
implementation "org.ojalgo:ojalgo:$ojalgoVersion"
2626
implementation "org.jacop:jacop:$jacopVersion"
27-
implementation 'org.apache.commons:commons-math3:3.6.1'
27+
implementation 'org.apache.commons:commons-math4-legacy:4.0-beta1'
2828
implementation 'org.optaplanner:optaplanner-core:7.71.0.Final'
2929
implementation 'ch.qos.logback:logback-classic:1.2.11' // optional for optaplanner debugging
3030
implementation "com.google.ortools:ortools-java:$ortoolsVersion"

subprojects/Diet/src/main/groovy/DietCommonsMath.groovy

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
//@Grab('org.apache.commons:commons-math3:3.6.1')
17-
import org.apache.commons.math3.optim.linear.*
18-
import org.apache.commons.math3.optim.nonlinear.scalar.GoalType
19-
import static org.apache.commons.math3.optim.linear.Relationship.*
16+
//@Grab('org.apache.commons:commons-math4-legacy:4.0-beta1')
17+
import org.apache.commons.math4.legacy.optim.linear.*
18+
import org.apache.commons.math4.legacy.optim.nonlinear.scalar.GoalType
19+
import static org.apache.commons.math4.legacy.optim.linear.Relationship.*
2020

2121
def cost = new LinearObjectiveFunction([2.0, 3.5, 8.0, 1.5, 11.0, 1.0] as double[], 0)
2222

subprojects/Monkeys/Monkeys.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repositories {
2121

2222
dependencies {
2323
implementation "org.apache.groovy:groovy:$groovy4Version"
24-
implementation 'org.apache.commons:commons-math3:3.6.1'
24+
implementation 'org.apache.commons:commons-math4-legacy:4.0-beta1'
2525
implementation 'io.jenetics:jenetics:6.3.0' // 5.2.0 = JDK8, 7.0.0 = JDK17
2626
}
2727

subprojects/Monkeys/src/main/groovy/ShakespeareCommonsMath.groovy

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
//@Grab('org.apache.commons:commons-math3:3.6.1')
1+
//@Grab('org.apache.commons:commons-math4:4.0-beta1')
22
// inspired by https://github.com/apache/commons-math/blob/MATH_3_X/src/userguide/java/org/apache/commons/math3/userguide/genetics/HelloWorldExample.java
33

44
import groovy.transform.*
5-
import org.apache.commons.math3.genetics.*
6-
import static org.apache.commons.math3.genetics.GeneticAlgorithm.randomGenerator as r
5+
import org.apache.commons.math4.legacy.genetics.*
6+
import static org.apache.commons.math4.legacy.genetics.GeneticAlgorithm.randomGenerator as r
77

88
class Scenario {
99
public static SENTENCE = "To be or not to be?"
@@ -19,20 +19,20 @@ double MUTATION_RATE = 0.03
1919
double ELITISM_RATE = 0.1
2020
int TOURNAMENT_ARITY = 2
2121

22-
GeneticAlgorithm ga = new GeneticAlgorithm(
22+
var ga = new GeneticAlgorithm(
2323
new OnePointCrossover<Character>(), CROSSOVER_RATE,
2424
new RandomCharacterMutation(), MUTATION_RATE,
2525
new TournamentSelection(TOURNAMENT_ARITY))
2626

27-
def randomSentence = (0..<Scenario.DIMENSION).collect{ Scenario.randomChar }
28-
def popList = (0..<POPULATION_SIZE).collect{ new StringChromosome(randomSentence) }
29-
Population initial = new ElitisticListPopulation(popList, 2 * popList.size(), ELITISM_RATE)
27+
var randomSentence = (0..<Scenario.DIMENSION).collect{ Scenario.randomChar }
28+
var popList = (0..<POPULATION_SIZE).collect{ new StringChromosome(randomSentence) }
29+
var initial = new ElitisticListPopulation(popList, 2 * popList.size(), ELITISM_RATE)
3030

31-
def stoppingCondition = new StoppingCondition() {
31+
var stoppingCondition = new StoppingCondition() {
3232
int generation = 0
3333

3434
boolean isSatisfied(Population population) {
35-
Chromosome fittestChromosome = population.fittestChromosome
35+
var fittestChromosome = population.fittestChromosome
3636
if (generation == 1 || generation % 10 == 0)
3737
println "Generation $generation: $fittestChromosome"
3838
generation++
@@ -41,15 +41,15 @@ def stoppingCondition = new StoppingCondition() {
4141
}
4242

4343
println "Starting evolution ..."
44-
Population finalPopulation = ga.evolve(initial, stoppingCondition)
44+
var finalPopulation = ga.evolve(initial, stoppingCondition)
4545
println "Generation $ga.generationsEvolved: $finalPopulation.fittestChromosome"
4646

4747
@InheritConstructors @AutoImplement
4848
class StringChromosome extends AbstractListChromosome<Character> {
4949
double fitness() {
5050
(0..<Scenario.DIMENSION).inject(0) { sum, i ->
51-
def target = Scenario.SENTENCE.charAt(i)
52-
def allele = representation.get(i).charValue()
51+
var target = Scenario.SENTENCE.charAt(i)
52+
var allele = representation.get(i).charValue()
5353
// fitter if closer ascii "distance"
5454
sum - (target - allele).abs()
5555
}
@@ -63,7 +63,7 @@ class StringChromosome extends AbstractListChromosome<Character> {
6363
class RandomCharacterMutation implements MutationPolicy {
6464
Chromosome mutate(Chromosome original) {
6565
int mutationIndex = r.nextInt(Scenario.DIMENSION)
66-
def mutation = original.representation.toList()
66+
var mutation = original.representation.toList()
6767
mutation.set(mutationIndex, Scenario.randomChar)
6868
original.newFixedLengthChromosome(mutation)
6969
}

subprojects/Monkeys/src/main/groovy/ShakespeareJenetics.groovy

+9-9
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@ import io.jenetics.*
66
import io.jenetics.engine.*
77
import io.jenetics.util.CharSeq
88

9-
def SENTENCE = "To be or not to be?"
9+
var SENTENCE = "To be or not to be?"
1010
int DIMENSION = SENTENCE.size()
11-
def POSSIBLE_CHARS = new CharSeq(('a'..'z') + ('A'..'Z') + " !?.".toList() as char[])
11+
var POSSIBLE_CHARS = new CharSeq(('a'..'z') + ('A'..'Z') + " !?.".toList() as char[])
1212
int SIZE = POSSIBLE_CHARS.size()
1313

14-
def fitness = { Genotype gt ->
14+
var fitness = { Genotype gt ->
1515
(0..<DIMENSION).inject(0) { sum, i ->
16-
def target = SENTENCE.charAt(i)
17-
def allele = gt.chromosome().get(i).allele()
16+
var target = SENTENCE.charAt(i)
17+
var allele = gt.chromosome().get(i).allele()
1818
int exactBonus = allele == target ? 100 : 0
1919
sum + SIZE - (target - allele).abs() + exactBonus
2020
}
2121
}
2222

23-
def gtf = Genotype.of([CharacterChromosome.of(POSSIBLE_CHARS, DIMENSION)])
24-
def engine = Engine.builder(fitness, gtf).offspringSelector(new RouletteWheelSelector()).build()
25-
def log = { EvolutionResult er -> if (er.generation() % 500 == 1) println er.bestPhenotype().genotype() }
26-
def result = engine.stream().limit(10000).peek(log).collect(EvolutionResult.toBestGenotype())
23+
var gtf = Genotype.of([CharacterChromosome.of(POSSIBLE_CHARS, DIMENSION)])
24+
var engine = Engine.builder(fitness, gtf).offspringSelector(new RouletteWheelSelector()).build()
25+
var log = { EvolutionResult er -> if (er.generation() % 500 == 1) println er.bestPhenotype().genotype() }
26+
var result = engine.stream().limit(10000).peek(log).collect(EvolutionResult.toBestGenotype())
2727
println "Result: $result"

subprojects/SendMoreMoney/SendMoreMoney.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ dependencies {
3333
exclude(group: 'com.javasolver', module :'jsr331-choco2')
3434
}
3535
runtimeOnly files('lib/choco-solver-2.1.5.jar')
36-
runtimeOnly 'org.slf4j:slf4j-simple:2.0.0'
36+
runtimeOnly 'org.slf4j:slf4j-simple:2.0.6'
3737
}
3838

3939
FileUtil.baseNames(sourceSets.main.allSource.files).each { name ->

0 commit comments

Comments
 (0)