diff --git a/.gitignore b/.gitignore index 3571812e54dd6435a0caaf9adf9245558611396f..d89923130df35a35937d4c40e44985773a228a75 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,7 @@ bin/ /src/test/java/fr/univamu/solver/PrivateTestInterval.java /src/test/java/fr/univamu/solver/PrivateTestReducer.java /src/test/java/fr/univamu/solver/PrivateTestSolver.java +/src/main/java/fr/univamu/solver/PrivateBuilder.java + +/src/main/java/fr/univamu/privateSolver/* +/src/test/java/fr/univamu/privateSolver/* diff --git a/.idea/workspace.xml b/.idea/workspace.xml index b694904636aa026334335691a6969a70454d3c34..3eb1ae912f3f815c82ceab1e5176fc6751d60e8b 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,10 +5,11 @@ </component> <component name="ChangeListManager"> <list default="true" id="a17b64ea-8b68-4cd2-aba6-1780c674b35e" name="Changes" comment="Clean"> + <change afterPath="$PROJECT_DIR$/src/main/java/fr/univamu/solver/ISolver.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/.idea/gradle.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/gradle.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/fr/univamu/solver/Solver.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/fr/univamu/solver/Solver.java" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/src/test/java/fr/univamu/solver/TestSolver.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/fr/univamu/solver/TestSolver.java" afterDir="false" /> </list> <option name="SHOW_DIALOG" value="false" /> <option name="HIGHLIGHT_CONFLICTS" value="true" /> @@ -20,9 +21,57 @@ <ProjectState /> </projectState> </component> + <component name="ExternalProjectsManager"> + <system id="GRADLE"> + <state> + <task path="$PROJECT_DIR$"> + <activation /> + </task> + <projects_view> + <tree_state> + <expand> + <path> + <item name="" type="6a2764b6:ExternalProjectsStructure$RootNode" /> + <item name="GL-Solver" type="f1a62948:ProjectNode" /> + </path> + </expand> + <select /> + </tree_state> + </projects_view> + </state> + </system> + </component> + <component name="FileTemplateManagerImpl"> + <option name="RECENT_TEMPLATES"> + <list> + <option value="Record" /> + <option value="Class" /> + <option value="Interface" /> + </list> + </option> + </component> <component name="Git.Settings"> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> </component> + <component name="GitLabMergeRequestFiltersHistory">{ + "lastFilter": { + "state": "OPENED", + "assignee": { + "type": "org.jetbrains.plugins.gitlab.mergerequest.ui.filters.GitLabMergeRequestsFiltersValue.MergeRequestsMemberFilterValue.MergeRequestsAssigneeFilterValue", + "username": "massat", + "fullname": "MASSAT Jean luc" + } + } +}</component> + <component name="GitLabMergeRequestsSettings">{ + "selectedUrlAndAccountId": { + "first": "git@etulab.univ-amu.fr:massat/gl-solver.git", + "second": "7a5f2ac7-26bf-451b-addf-84346e1e946e" + } +}</component> + <component name="ProblemsViewState"> + <option name="selectedTabId" value="CurrentFile" /> + </component> <component name="ProjectColorInfo">{ "associatedIndex": 2 }</component> @@ -32,37 +81,129 @@ <option name="hideEmptyMiddlePackages" value="true" /> <option name="showLibraryContents" value="true" /> </component> - <component name="PropertiesComponent">{ - "keyToString": { - "Gradle.GL-Solver [:fr.univamu.solver.Main.main()].executor": "Run", - "Gradle.Tests in 'GL-Solver'.executor": "Run", - "Gradle.Tests in 'fr.univamu.solver'.executor": "Run", - "RunOnceActivity.ShowReadmeOnStart": "true", - "git-widget-placeholder": "master", - "kotlin-language-version-configured": "true", - "node.js.detected.package.eslint": "true", - "node.js.detected.package.tslint": "true", - "node.js.selected.package.eslint": "(autodetect)", - "node.js.selected.package.tslint": "(autodetect)", - "nodejs_package_manager_path": "npm", - "vue.rearranger.settings.migration": "true" + <component name="PropertiesComponent"><![CDATA[{ + "keyToString": { + "Gradle.Build GL-Solver.executor": "Run", + "Gradle.GL-Solver [:fr.univamu.solver.Main.main()].executor": "Run", + "Gradle.GL-Solver [build].executor": "Run", + "Gradle.PrivateTestSolver.executor": "Run", + "Gradle.PrivateTestSolver.test4Students.executor": "Run", + "Gradle.PrivateTestSolver.testErrorSolution.executor": "Run", + "Gradle.PrivateTestSolver.testOpti.executor": "Run", + "Gradle.PrivateTestSolver.testOptiSimple.executor": "Run", + "Gradle.PrivateTestSolver.testQueens8.executor": "Run", + "Gradle.PrivateTestSolver.testReduction.executor": "Run", + "Gradle.TestPrivateSolver.executor": "Run", + "Gradle.TestPrivateSolver.test1Students.executor": "Run", + "Gradle.TestPrivateSolver.test2Students.executor": "Run", + "Gradle.TestPrivateSolver.test4Students.executor": "Run", + "Gradle.TestPrivateSolver.testOpti.executor": "Run", + "Gradle.TestPrivateSolver.testOptimization.executor": "Run", + "Gradle.TestPrivateSolver.testPrivateSolver.executor": "Run", + "Gradle.TestPrivateSolver.testReduction.executor": "Run", + "Gradle.Tests in 'GL-Solver'.executor": "Run", + "Gradle.Tests in 'fr.univamu.solver'.executor": "Run", + "RunOnceActivity.ShowReadmeOnStart": "true", + "RunOnceActivity.git.unshallow": "true", + "git-widget-placeholder": "master", + "kotlin-language-version-configured": "true", + "last_opened_file_path": "/home/massat/Intellij/GL-Solver/src/main/java/fr/univamu/xxxx", + "node.js.detected.package.eslint": "true", + "node.js.detected.package.tslint": "true", + "node.js.selected.package.eslint": "(autodetect)", + "node.js.selected.package.tslint": "(autodetect)", + "nodejs_package_manager_path": "npm", + "project.structure.last.edited": "Project", + "project.structure.proportion": "0.15", + "project.structure.side.proportion": "0.2", + "settings.editor.selected.configurable": "reference.settingsdialog.project.gradle", + "vue.rearranger.settings.migration": "true" } -}</component> +}]]></component> + <component name="RecentsManager"> + <key name="CopyFile.RECENT_KEYS"> + <recent name="$PROJECT_DIR$/src/main/java/fr/univamu/xxxx" /> + <recent name="$PROJECT_DIR$/src/main/java/fr/univamu/solver" /> + </key> + <key name="CopyClassDialog.RECENTS_KEY"> + <recent name="fr.univamu.privateSolver" /> + <recent name="fr.univamu.xxxx" /> + </key> + </component> <component name="RunManager" selected="Gradle.Tests in 'GL-Solver'"> - <configuration name="Main" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> - <option name="MAIN_CLASS_NAME" value="fr.univamu.solver.Main" /> - <module name="GL-Solver.main" /> - <extension name="coverage"> - <pattern> - <option name="PATTERN" value="fr.univamu.solver.*" /> - <option name="ENABLED" value="true" /> - </pattern> - </extension> - <method v="2"> - <option name="Make" enabled="true" /> - </method> + <configuration name="TestPrivateSolver.test1Students" type="GradleRunConfiguration" factoryName="Gradle" temporary="true"> + <ExternalSystemSettings> + <option name="executionName" /> + <option name="externalProjectPath" value="$PROJECT_DIR$" /> + <option name="externalSystemIdString" value="GRADLE" /> + <option name="scriptParameters" value="" /> + <option name="taskDescriptions"> + <list /> + </option> + <option name="taskNames"> + <list> + <option value=":test" /> + <option value="--tests" /> + <option value=""fr.univamu.privateSolver.TestPrivateSolver.test1Students"" /> + </list> + </option> + <option name="vmOptions" /> + </ExternalSystemSettings> + <ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess> + <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> + <DebugAllEnabled>false</DebugAllEnabled> + <RunAsTest>true</RunAsTest> + <method v="2" /> </configuration> - <configuration name="Tests in 'GL-Solver'" type="GradleRunConfiguration" factoryName="Gradle" temporary="true"> + <configuration name="TestPrivateSolver.test1Students" type="GradleRunConfiguration" factoryName="Gradle" temporary="true"> + <ExternalSystemSettings> + <option name="executionName" /> + <option name="externalProjectPath" value="$PROJECT_DIR$" /> + <option name="externalSystemIdString" value="GRADLE" /> + <option name="scriptParameters" value="" /> + <option name="taskDescriptions"> + <list /> + </option> + <option name="taskNames"> + <list> + <option value=":test" /> + <option value="--tests" /> + <option value=""fr.univamu.privateSolver.TestPrivateSolver.test1Students"" /> + </list> + </option> + <option name="vmOptions" /> + </ExternalSystemSettings> + <ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess> + <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> + <DebugAllEnabled>false</DebugAllEnabled> + <RunAsTest>true</RunAsTest> + <method v="2" /> + </configuration> + <configuration name="TestPrivateSolver.test2Students" type="GradleRunConfiguration" factoryName="Gradle" temporary="true"> + <ExternalSystemSettings> + <option name="executionName" /> + <option name="externalProjectPath" value="$PROJECT_DIR$" /> + <option name="externalSystemIdString" value="GRADLE" /> + <option name="scriptParameters" value="" /> + <option name="taskDescriptions"> + <list /> + </option> + <option name="taskNames"> + <list> + <option value=":test" /> + <option value="--tests" /> + <option value=""fr.univamu.privateSolver.TestPrivateSolver.test2Students"" /> + </list> + </option> + <option name="vmOptions" /> + </ExternalSystemSettings> + <ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess> + <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> + <DebugAllEnabled>false</DebugAllEnabled> + <RunAsTest>true</RunAsTest> + <method v="2" /> + </configuration> + <configuration name="TestPrivateSolver.test2Students" type="GradleRunConfiguration" factoryName="Gradle" temporary="true"> <ExternalSystemSettings> <option name="executionName" /> <option name="externalProjectPath" value="$PROJECT_DIR$" /> @@ -74,6 +215,8 @@ <option name="taskNames"> <list> <option value=":test" /> + <option value="--tests" /> + <option value=""fr.univamu.privateSolver.TestPrivateSolver.test2Students"" /> </list> </option> <option name="vmOptions" /> @@ -84,7 +227,7 @@ <RunAsTest>true</RunAsTest> <method v="2" /> </configuration> - <configuration name="Tests in 'fr.univamu.solver'" type="GradleRunConfiguration" factoryName="Gradle" temporary="true"> + <configuration name="TestPrivateSolver.test4Students" type="GradleRunConfiguration" factoryName="Gradle" temporary="true"> <ExternalSystemSettings> <option name="executionName" /> <option name="externalProjectPath" value="$PROJECT_DIR$" /> @@ -97,7 +240,123 @@ <list> <option value=":test" /> <option value="--tests" /> - <option value=""fr.univamu.solver.*"" /> + <option value=""fr.univamu.privateSolver.TestPrivateSolver.test4Students"" /> + </list> + </option> + <option name="vmOptions" /> + </ExternalSystemSettings> + <ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess> + <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> + <DebugAllEnabled>false</DebugAllEnabled> + <RunAsTest>true</RunAsTest> + <method v="2" /> + </configuration> + <configuration name="TestPrivateSolver.test4Students" type="GradleRunConfiguration" factoryName="Gradle" temporary="true"> + <ExternalSystemSettings> + <option name="executionName" /> + <option name="externalProjectPath" value="$PROJECT_DIR$" /> + <option name="externalSystemIdString" value="GRADLE" /> + <option name="scriptParameters" value="" /> + <option name="taskDescriptions"> + <list /> + </option> + <option name="taskNames"> + <list> + <option value=":test" /> + <option value="--tests" /> + <option value=""fr.univamu.privateSolver.TestPrivateSolver.test4Students"" /> + </list> + </option> + <option name="vmOptions" /> + </ExternalSystemSettings> + <ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess> + <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> + <DebugAllEnabled>false</DebugAllEnabled> + <RunAsTest>true</RunAsTest> + <method v="2" /> + </configuration> + <configuration name="TestPrivateSolver.testOpti" type="GradleRunConfiguration" factoryName="Gradle" temporary="true"> + <ExternalSystemSettings> + <option name="executionName" /> + <option name="externalProjectPath" value="$PROJECT_DIR$" /> + <option name="externalSystemIdString" value="GRADLE" /> + <option name="scriptParameters" value="" /> + <option name="taskDescriptions"> + <list /> + </option> + <option name="taskNames"> + <list> + <option value=":test" /> + <option value="--tests" /> + <option value=""fr.univamu.privateSolver.TestPrivateSolver.testOpti"" /> + </list> + </option> + <option name="vmOptions" /> + </ExternalSystemSettings> + <ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess> + <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> + <DebugAllEnabled>false</DebugAllEnabled> + <RunAsTest>true</RunAsTest> + <method v="2" /> + </configuration> + <configuration name="TestPrivateSolver.testOpti" type="GradleRunConfiguration" factoryName="Gradle" temporary="true"> + <ExternalSystemSettings> + <option name="executionName" /> + <option name="externalProjectPath" value="$PROJECT_DIR$" /> + <option name="externalSystemIdString" value="GRADLE" /> + <option name="scriptParameters" value="" /> + <option name="taskDescriptions"> + <list /> + </option> + <option name="taskNames"> + <list> + <option value=":test" /> + <option value="--tests" /> + <option value=""fr.univamu.privateSolver.TestPrivateSolver.testOpti"" /> + </list> + </option> + <option name="vmOptions" /> + </ExternalSystemSettings> + <ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess> + <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> + <DebugAllEnabled>false</DebugAllEnabled> + <RunAsTest>true</RunAsTest> + <method v="2" /> + </configuration> + <configuration name="Tests in 'GL-Solver'" type="GradleRunConfiguration" factoryName="Gradle" temporary="true"> + <ExternalSystemSettings> + <option name="executionName" /> + <option name="externalProjectPath" value="$PROJECT_DIR$" /> + <option name="externalSystemIdString" value="GRADLE" /> + <option name="scriptParameters" value="" /> + <option name="taskDescriptions"> + <list /> + </option> + <option name="taskNames"> + <list> + <option value=":test" /> + </list> + </option> + <option name="vmOptions" /> + </ExternalSystemSettings> + <ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess> + <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> + <DebugAllEnabled>false</DebugAllEnabled> + <RunAsTest>true</RunAsTest> + <method v="2" /> + </configuration> + <configuration name="Tests in 'GL-Solver'" type="GradleRunConfiguration" factoryName="Gradle" temporary="true"> + <ExternalSystemSettings> + <option name="executionName" /> + <option name="externalProjectPath" value="$PROJECT_DIR$" /> + <option name="externalSystemIdString" value="GRADLE" /> + <option name="scriptParameters" value="" /> + <option name="taskDescriptions"> + <list /> + </option> + <option name="taskNames"> + <list> + <option value=":test" /> </list> </option> <option name="vmOptions" /> @@ -111,16 +370,18 @@ <recent_temporary> <list> <item itemvalue="Gradle.Tests in 'GL-Solver'" /> - <item itemvalue="Gradle.Tests in 'fr.univamu.solver'" /> - <item itemvalue="Application.Main" /> + <item itemvalue="Gradle.TestPrivateSolver.testOpti" /> + <item itemvalue="Gradle.TestPrivateSolver.test4Students" /> + <item itemvalue="Gradle.TestPrivateSolver.test1Students" /> + <item itemvalue="Gradle.TestPrivateSolver.test2Students" /> </list> </recent_temporary> </component> <component name="SharedIndexes"> <attachedChunks> <set> - <option value="bundled-jdk-9823dce3aa75-28b599e66164-intellij.indexing.shared.core-IU-242.23339.11" /> - <option value="bundled-js-predefined-d6986cc7102b-5c90d61e3bab-JavaScript-IU-242.23339.11" /> + <option value="bundled-jdk-9823dce3aa75-fdfe4dae3a2d-intellij.indexing.shared.core-IU-243.22562.218" /> + <option value="bundled-js-predefined-d6986cc7102b-deb605915726-JavaScript-IU-243.22562.218" /> </set> </attachedChunks> </component> @@ -134,6 +395,29 @@ <updated>1727967430355</updated> <workItem from="1727967431394" duration="6834000" /> <workItem from="1728024944251" duration="2652000" /> + <workItem from="1728040954730" duration="5000" /> + <workItem from="1728123345262" duration="458000" /> + <workItem from="1728201158990" duration="1084000" /> + <workItem from="1728390692872" duration="220000" /> + <workItem from="1728401441929" duration="657000" /> + <workItem from="1728402235461" duration="1455000" /> + <workItem from="1728404017779" duration="4616000" /> + <workItem from="1728412974116" duration="261000" /> + <workItem from="1728459121253" duration="15078000" /> + <workItem from="1728552052734" duration="1153000" /> + <workItem from="1728574571500" duration="1807000" /> + <workItem from="1728628311348" duration="388000" /> + <workItem from="1728628706992" duration="7465000" /> + <workItem from="1728898954770" duration="757000" /> + <workItem from="1728912262164" duration="5827000" /> + <workItem from="1728976979580" duration="7761000" /> + <workItem from="1728990686795" duration="5353000" /> + <workItem from="1729001677350" duration="5084000" /> + <workItem from="1729063134462" duration="12979000" /> + <workItem from="1729167435627" duration="76000" /> + <workItem from="1729500223471" duration="1245000" /> + <workItem from="1731343860000" duration="114000" /> + <workItem from="1736264171106" duration="2061000" /> </task> <task id="LOCAL-00001" summary="Create"> <option name="closed" value="true" /> @@ -175,7 +459,15 @@ <option name="project" value="LOCAL" /> <updated>1727988463386</updated> </task> - <option name="localTasksCounter" value="6" /> + <task id="LOCAL-00006" summary="Clean"> + <option name="closed" value="true" /> + <created>1728032021786</created> + <option name="number" value="00006" /> + <option name="presentableId" value="LOCAL-00006" /> + <option name="project" value="LOCAL" /> + <updated>1728032021786</updated> + </task> + <option name="localTasksCounter" value="7" /> <servers /> </component> <component name="TypeScriptGeneratedFilesManager"> diff --git a/src/main/java/fr/univamu/solver/ISolver.java b/src/main/java/fr/univamu/solver/ISolver.java new file mode 100644 index 0000000000000000000000000000000000000000..184e67012013e03df264612a15e67c05fb75c0ae --- /dev/null +++ b/src/main/java/fr/univamu/solver/ISolver.java @@ -0,0 +1,7 @@ +package fr.univamu.solver; + +public interface ISolver { + + void reduceAndCheckIntervalsStrategy(); + +} diff --git a/src/main/java/fr/univamu/solver/Solver.java b/src/main/java/fr/univamu/solver/Solver.java index 823321e2cfeef7f5b6f15f56f08b2ac9aa676950..dfcabf977c7f3c6333aa6f1f28387ca82cc7d886 100644 --- a/src/main/java/fr/univamu/solver/Solver.java +++ b/src/main/java/fr/univamu/solver/Solver.java @@ -37,7 +37,7 @@ class Constraint { } } -public class Solver { +public class Solver implements ISolver { private static final int CHECK_INTERVALS_STRATEGY = 1; private static final int REDUCE_AND_CHECK_INTERVALS_STRATEGY = 2; @@ -142,7 +142,7 @@ public class Solver { return true; } - public Variable findVariable() { + private Variable findVariable() { Variable best = null; for (Variable v : variables) { if (v.isFixed()) continue; @@ -200,7 +200,7 @@ public class Solver { return result; } - public Variable newVar() { + private Variable newVar() { var v = new Variable(variables.size()); variables.add(v); return v; diff --git a/src/test/java/fr/univamu/solver/TestSolver.java b/src/test/java/fr/univamu/solver/TestSolver.java index 37900a72307c4a7eff7d1e8ab6924947e7b20c7f..078af927a75c61257dfcf30760457609c8084d50 100644 --- a/src/test/java/fr/univamu/solver/TestSolver.java +++ b/src/test/java/fr/univamu/solver/TestSolver.java @@ -10,23 +10,23 @@ public class TestSolver { @Test public void testDomain() { var solver = new Solver(); - solver.newVar().domain(0, 9); - solver.newVar().domain(100, 109); + solver.newVar("X").domain(0, 9); + solver.newVar("Y").domain(100, 109); assertEquals(100, solver.solve()); } @Test public void testDomainEmpty() { var solver = new Solver(); - solver.newVar().domain(20, 10); + solver.newVar("X").domain(20, 10); assertEquals(0, solver.solve()); } @Test public void testConstraintAdd() { var solver = new Solver(); - var a = solver.newVar().domain(0, 9); - var b = solver.newVar().domain(0, 9); + var a = solver.newVar("a").domain(0, 9); + var b = solver.newVar("b").domain(0, 9); solver.addConstraint(5, "=", a, "+", b);// 5=A+B assertEquals(6, solver.solve()); } @@ -34,8 +34,8 @@ public class TestSolver { @Test public void testConstraintSub() { var solver = new Solver(); - var a = solver.newVar().domain(0, 9); - var b = solver.newVar().domain(0, 9); + var a = solver.newVar("a").domain(0, 9); + var b = solver.newVar("b").domain(0, 9); solver.addConstraint(5, "=", a, "-", b);// 5=A-B assertEquals(5, solver.solve()); } @@ -43,8 +43,8 @@ public class TestSolver { @Test public void testConstraintMul() { var solver = new Solver(); - var a = solver.newVar().domain(0, 9); - var b = solver.newVar().domain(0, 9); + var a = solver.newVar("a").domain(0, 9); + var b = solver.newVar("b").domain(0, 9); solver.addConstraint(a, "=", b, "*", 2);// A=B*2 assertEquals(5, solver.solve()); } @@ -52,8 +52,8 @@ public class TestSolver { @Test public void testConstraintDiv() { var solver = new Solver(); - var a = solver.newVar().domain(0, 99); - var b = solver.newVar().domain(0, 9); + var a = solver.newVar("a").domain(0, 99); + var b = solver.newVar("b").domain(0, 9); solver.addConstraint(a, "=", b, "/", 2);// A=B/2 assertEquals(10, solver.solve()); } @@ -61,8 +61,8 @@ public class TestSolver { @Test public void testConstraintEq() { var solver = new Solver(); - var a = solver.newVar().domain(0, 5); - var b = solver.newVar().domain(4, 9); + var a = solver.newVar("a").domain(0, 5); + var b = solver.newVar("b").domain(4, 9); solver.addConstraint(a, "=", b); assertEquals(2, solver.solve()); }