Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GL-Solver
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MASSAT Jean luc
GL-Solver
Commits
36764f48
Commit
36764f48
authored
8 months ago
by
MASSAT Jean luc
Browse files
Options
Downloads
Patches
Plain Diff
Update
parent
7728fd27
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+3
-0
3 additions, 0 deletions
.gitignore
.idea/gradle.xml
+1
-0
1 addition, 0 deletions
.idea/gradle.xml
.idea/workspace.xml
+32
-20
32 additions, 20 deletions
.idea/workspace.xml
src/main/java/fr/univamu/solver/Solver.java
+42
-45
42 additions, 45 deletions
src/main/java/fr/univamu/solver/Solver.java
with
78 additions
and
65 deletions
.gitignore
+
3
−
0
View file @
36764f48
...
...
@@ -8,6 +8,9 @@ build/
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/gradle.xml
.idea/vcs.xml
.idea/workspace.xml
.idea/libraries/
*.iws
*.iml
...
...
This diff is collapsed.
Click to expand it.
.idea/gradle.xml
+
1
−
0
View file @
36764f48
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"GradleMigrationSettings"
migrationVersion=
"1"
/>
<component
name=
"GradleSettings"
>
<option
name=
"linkedExternalProjectsSettings"
>
<GradleProjectSettings>
...
...
This diff is collapsed.
Click to expand it.
.idea/workspace.xml
+
32
−
20
View file @
36764f48
...
...
@@ -5,7 +5,10 @@
</component>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"a17b64ea-8b68-4cd2-aba6-1780c674b35e"
name=
"Changes"
comment=
"Clean"
>
<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"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
...
...
@@ -20,31 +23,31 @@
<component
name=
"Git.Settings"
>
<option
name=
"RECENT_GIT_ROOT_PATH"
value=
"$PROJECT_DIR$"
/>
</component>
<component
name=
"ProjectColorInfo"
>
<![CDATA[
{
"
associatedIndex
"
: 2
}
]]>
</component>
<component
name=
"ProjectColorInfo"
>
{
"
associatedIndex
"
: 2
}
</component>
<component
name=
"ProjectId"
id=
"2mvqVujSHxI14AYjE6lvdsJNkMj"
/>
<component
name=
"ProjectLevelVcsManager"
settingsEditedManually=
"true"
/>
<component
name=
"ProjectViewState"
>
<option
name=
"hideEmptyMiddlePackages"
value=
"true"
/>
<option
name=
"showLibraryContents"
value=
"true"
/>
</component>
<component
name=
"PropertiesComponent"
>
<![CDATA[
{
"
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"
>
{
"
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>
}
</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"
/>
...
...
@@ -129,7 +132,8 @@
<option
name=
"number"
value=
"Default"
/>
<option
name=
"presentableId"
value=
"Default"
/>
<updated>
1727967430355
</updated>
<workItem
from=
"1727967431394"
duration=
"6814000"
/>
<workItem
from=
"1727967431394"
duration=
"6834000"
/>
<workItem
from=
"1728024944251"
duration=
"2652000"
/>
</task>
<task
id=
"LOCAL-00001"
summary=
"Create"
>
<option
name=
"closed"
value=
"true"
/>
...
...
@@ -163,7 +167,15 @@
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1727971953919
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"5"
/>
<task
id=
"LOCAL-00005"
summary=
"Clean"
>
<option
name=
"closed"
value=
"true"
/>
<created>
1727988463386
</created>
<option
name=
"number"
value=
"00005"
/>
<option
name=
"presentableId"
value=
"LOCAL-00005"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1727988463386
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"6"
/>
<servers
/>
</component>
<component
name=
"TypeScriptGeneratedFilesManager"
>
...
...
This diff is collapsed.
Click to expand it.
src/main/java/fr/univamu/solver/Solver.java
+
42
−
45
View file @
36764f48
...
...
@@ -50,6 +50,7 @@ public class Solver {
private
long
nodesCounter
=
0
;
private
long
maxNodes
=
1000_000_000L
;
private
boolean
verbose
=
true
;
private
boolean
modified
=
false
;
public
void
reduceAndCheckIntervalsStrategy
()
{
strategy
=
REDUCE_AND_CHECK_INTERVALS_STRATEGY
;
...
...
@@ -73,23 +74,6 @@ public class Solver {
return
(!
ko
);
}
private
boolean
reduceAddConstraint
(
Constraint
c
)
{
var
change
=
c
.
getResult
().
reduce
(
c
.
getVar1
().
add
(
c
.
getVar2
()));
change
=
c
.
getVar1
().
reduce
(
c
.
getResult
().
sub
(
c
.
getVar2
()))
||
change
;
change
=
c
.
getVar2
().
reduce
(
c
.
getResult
().
sub
(
c
.
getVar1
()))
||
change
;
return
change
;
}
private
boolean
reduceMulConstraint
(
Constraint
c
)
{
var
change
=
false
;
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
change
=
c
.
getResult
().
reduce
(
c
.
getVar1
().
mul
(
c
.
getVar2
()))
||
change
;
change
=
c
.
getVar2
().
reduce
(
c
.
getResult
().
inverseMul
(
c
.
getVar1
()))
||
change
;
change
=
c
.
getVar1
().
reduce
(
c
.
getResult
().
inverseMul
(
c
.
getVar2
()))
||
change
;
}
return
change
;
}
private
boolean
checkConstraintIntervalsStrategy
(
Constraint
c
)
{
return
switch
(
c
.
getType
())
{
case
'+'
->
checkAddConstraintIntervalsStrategy
(
c
);
...
...
@@ -100,12 +84,46 @@ public class Solver {
};
}
private
boolean
reduce
(
Constraint
c
)
{
return
switch
(
c
.
getType
())
{
case
'+'
->
reduceAddConstraint
(
c
);
case
'*'
->
reduceMulConstraint
(
c
);
default
->
false
;
};
private
void
reduceAddConstraint
(
Constraint
c
)
{
modified
=
c
.
getResult
().
reduce
(
c
.
getVar1
().
add
(
c
.
getVar2
()))
||
modified
;
modified
=
c
.
getVar1
().
reduce
(
c
.
getResult
().
sub
(
c
.
getVar2
()))
||
modified
;
modified
=
c
.
getVar2
().
reduce
(
c
.
getResult
().
sub
(
c
.
getVar1
()))
||
modified
;
}
private
void
reduceMulConstraint
(
Constraint
c
)
{
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
modified
=
c
.
getResult
().
reduce
(
c
.
getVar1
().
mul
(
c
.
getVar2
()))
||
modified
;
modified
=
c
.
getVar2
().
reduce
(
c
.
getResult
().
inverseMul
(
c
.
getVar1
()))
||
modified
;
modified
=
c
.
getVar1
().
reduce
(
c
.
getResult
().
inverseMul
(
c
.
getVar2
()))
||
modified
;
}
}
private
void
reduce
(
Constraint
c
)
{
switch
(
c
.
getType
())
{
case
'+'
:
reduceAddConstraint
(
c
);
break
;
case
'*'
:
reduceMulConstraint
(
c
);
break
;
}
}
private
void
reduce
()
{
if
(
verbose
)
{
System
.
out
.
println
(
"Variables before reduction:"
);
variables
.
forEach
(
System
.
out
::
println
);
}
do
{
modified
=
false
;
constraints
.
forEach
(
this
::
reduce
);
}
while
(
modified
);
if
(
verbose
)
{
System
.
out
.
println
(
"Variables after reduction:"
);
variables
.
forEach
(
System
.
out
::
println
);
}
}
private
boolean
checkConstraint
(
Constraint
c
)
{
...
...
@@ -342,27 +360,6 @@ public class Solver {
return
result
;
}
private
void
reduce
()
{
if
(
verbose
)
{
System
.
out
.
println
(
"Variables before reduction:"
);
variables
.
forEach
(
System
.
out
::
println
);
}
for
(
boolean
change
=
true
;
change
;
)
{
change
=
false
;
for
(
Constraint
c
:
constraints
)
{
if
(
reduce
(
c
))
{
change
=
true
;
}
}
}
if
(
verbose
)
{
System
.
out
.
println
(
"Variables after reduction:"
);
variables
.
forEach
(
System
.
out
::
println
);
}
}
public
long
solve
()
{
this
.
solutionsCounter
=
0
;
this
.
nodesCounter
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment