Skip to content

Commit 158aca7

Browse files
feat: Add support for enterprise edition and multithreaded solving (#31)
* feat: Add support for enterprise edition and multithreaded solving - To install enterprise edition: - Replace `timefold-solver` with `timefold-solver-enterprise` (which has `timefold-solver` as a dependency). - Add tests for the exception raised when an enterprise feature is requested and enterprise is not installed - Add support for multithreaded solving in the SolverConfig - Use PlanningImmutable API for immutable types in the Java Python Interpreter
1 parent 3f4d4a9 commit 158aca7

File tree

17 files changed

+89
-16
lines changed

17 files changed

+89
-16
lines changed

jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/Ellipsis.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package ai.timefold.jpyinterpreter.types;
22

33
import ai.timefold.jpyinterpreter.builtins.GlobalBuiltins;
4+
import ai.timefold.solver.core.impl.domain.solution.cloner.PlanningImmutable;
45

5-
public class Ellipsis extends AbstractPythonLikeObject {
6+
public class Ellipsis extends AbstractPythonLikeObject implements PlanningImmutable {
67
public static final Ellipsis INSTANCE;
78
public static final PythonLikeType ELLIPSIS_TYPE = new PythonLikeType("EllipsisType", Ellipsis.class);
89
public static final PythonLikeType $TYPE = ELLIPSIS_TYPE;

jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonBytes.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
import ai.timefold.jpyinterpreter.types.numeric.PythonInteger;
3030
import ai.timefold.jpyinterpreter.util.ByteCharSequence;
3131
import ai.timefold.jpyinterpreter.util.StringFormatter;
32+
import ai.timefold.solver.core.impl.domain.solution.cloner.PlanningImmutable;
3233

33-
public class PythonBytes extends AbstractPythonLikeObject implements PythonBytesLikeObject {
34+
public class PythonBytes extends AbstractPythonLikeObject implements PythonBytesLikeObject, PlanningImmutable {
3435

3536
public static final PythonBytes EMPTY = new PythonBytes(new byte[0]);
3637

jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonNone.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
import ai.timefold.jpyinterpreter.PythonUnaryOperator;
77
import ai.timefold.jpyinterpreter.builtins.GlobalBuiltins;
88
import ai.timefold.jpyinterpreter.types.numeric.PythonBoolean;
9+
import ai.timefold.solver.core.impl.domain.solution.cloner.PlanningImmutable;
910

10-
public class PythonNone extends AbstractPythonLikeObject {
11+
public class PythonNone extends AbstractPythonLikeObject implements PlanningImmutable {
1112
public static final PythonNone INSTANCE;
1213

1314
static {

jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/PythonString.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@
3737
import ai.timefold.jpyinterpreter.util.DefaultFormatSpec;
3838
import ai.timefold.jpyinterpreter.util.StringFormatter;
3939
import ai.timefold.jpyinterpreter.util.arguments.ArgumentSpec;
40+
import ai.timefold.solver.core.impl.domain.solution.cloner.PlanningImmutable;
4041

41-
public class PythonString extends AbstractPythonLikeObject implements PythonLikeComparable<PythonString> {
42+
public class PythonString extends AbstractPythonLikeObject implements PythonLikeComparable<PythonString>, PlanningImmutable {
4243
public final String value;
4344

4445
public final static PythonString EMPTY = new PythonString("");

jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/collections/PythonLikeTuple.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@
2626
import ai.timefold.jpyinterpreter.types.numeric.PythonBoolean;
2727
import ai.timefold.jpyinterpreter.types.numeric.PythonInteger;
2828
import ai.timefold.solver.core.impl.domain.solution.cloner.PlanningCloneable;
29+
import ai.timefold.solver.core.impl.domain.solution.cloner.PlanningImmutable;
2930

3031
public class PythonLikeTuple<T extends PythonLikeObject> extends AbstractPythonLikeObject implements List<T>,
3132
PlanningCloneable<PythonLikeTuple<T>>,
3233
PythonLikeComparable<PythonLikeTuple>,
34+
PlanningImmutable,
3335
RandomAccess {
3436
public static PythonLikeTuple EMPTY = PythonLikeTuple.fromList(Collections.emptyList());
3537

jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonDate.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@
2828
import ai.timefold.jpyinterpreter.types.numeric.PythonInteger;
2929
import ai.timefold.jpyinterpreter.types.numeric.PythonNumber;
3030
import ai.timefold.jpyinterpreter.util.arguments.ArgumentSpec;
31+
import ai.timefold.solver.core.impl.domain.solution.cloner.PlanningImmutable;
3132

3233
/**
3334
* Python docs: <a href="https://docs.python.org/3/library/datetime.html#datetime.date">date objects</a>
3435
*/
35-
public class PythonDate<T extends PythonDate<?>> extends AbstractPythonLikeObject implements PythonLikeComparable<T> {
36+
public class PythonDate<T extends PythonDate<?>> extends AbstractPythonLikeObject implements PythonLikeComparable<T>,
37+
PlanningImmutable {
3638
static final long EPOCH_ORDINAL_OFFSET = Duration.between(LocalDateTime.of(LocalDate.of(0, 12, 31), LocalTime.MIDNIGHT),
3739
LocalDateTime.of(LocalDate.ofEpochDay(0), LocalTime.MIDNIGHT)).toDays();
3840

jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonDateTime.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@
3232
import ai.timefold.jpyinterpreter.types.numeric.PythonInteger;
3333
import ai.timefold.jpyinterpreter.types.numeric.PythonNumber;
3434
import ai.timefold.jpyinterpreter.util.arguments.ArgumentSpec;
35+
import ai.timefold.solver.core.impl.domain.solution.cloner.PlanningImmutable;
3536

3637
/**
3738
* Python docs: <a href="https://docs.python.org/3/library/datetime.html#datetime.datetime">datetime objects</a>
3839
*/
39-
public class PythonDateTime extends PythonDate<PythonDateTime> {
40+
public class PythonDateTime extends PythonDate<PythonDateTime> implements PlanningImmutable {
4041
// Taken from https://docs.python.org/3/library/datetime.html#datetime.datetime.fromisoformat
4142
private static final Pattern ISO_FORMAT_PATTERN = Pattern.compile("^(?<year>\\d\\d\\d\\d)-(?<month>\\d\\d)-(?<day>\\d\\d)" +
4243
"(.(?<hour>\\d\\d)" +

jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonTime.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121
import ai.timefold.jpyinterpreter.types.errors.ValueError;
2222
import ai.timefold.jpyinterpreter.types.numeric.PythonInteger;
2323
import ai.timefold.jpyinterpreter.util.arguments.ArgumentSpec;
24+
import ai.timefold.solver.core.impl.domain.solution.cloner.PlanningImmutable;
2425

25-
public class PythonTime extends AbstractPythonLikeObject {
26+
public class PythonTime extends AbstractPythonLikeObject implements PlanningImmutable {
2627
// Taken from https://docs.python.org/3/library/datetime.html#datetime.time.fromisoformat
2728
private static final Pattern ISO_FORMAT_PATTERN = Pattern.compile("^(?<hour>\\d\\d)" +
2829
"(:(?<minute>\\d\\d)" +

jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonTimeDelta.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@
2020
import ai.timefold.jpyinterpreter.types.numeric.PythonInteger;
2121
import ai.timefold.jpyinterpreter.types.numeric.PythonNumber;
2222
import ai.timefold.jpyinterpreter.util.arguments.ArgumentSpec;
23+
import ai.timefold.solver.core.impl.domain.solution.cloner.PlanningImmutable;
2324

2425
/**
2526
* Python docs: <a href="https://docs.python.org/3/library/datetime.html#timedelta-objects">timedelta-objects</a>
2627
*/
27-
public class PythonTimeDelta extends AbstractPythonLikeObject implements PythonLikeComparable<PythonTimeDelta> {
28+
public class PythonTimeDelta extends AbstractPythonLikeObject implements PythonLikeComparable<PythonTimeDelta>,
29+
PlanningImmutable {
2830
private static final int NANOS_IN_SECOND = 1_000_000_000;
2931
private static final int SECONDS_IN_DAY = 86400; // 24 * 60 * 60
3032

jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/datetime/PythonTzinfo.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
import ai.timefold.jpyinterpreter.types.BuiltinTypes;
1111
import ai.timefold.jpyinterpreter.types.PythonLikeType;
1212
import ai.timefold.jpyinterpreter.types.PythonString;
13+
import ai.timefold.solver.core.impl.domain.solution.cloner.PlanningImmutable;
1314

14-
public class PythonTzinfo extends AbstractPythonLikeObject {
15+
public class PythonTzinfo extends AbstractPythonLikeObject implements PlanningImmutable {
1516
public static PythonLikeType TZ_INFO_TYPE = new PythonLikeType("tzinfo",
1617
PythonTzinfo.class);
1718

0 commit comments

Comments
 (0)