Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Conversion
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Vladislav Kiselev
Conversion
Commits
20b4658c
Commit
20b4658c
authored
Aug 15, 2019
by
Vladislav Kiselev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Теперь flatZinc solver-ы запускаются под Windows
parent
11b61d5d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
src/inport/ConversionUtils/Solver.java
src/inport/ConversionUtils/Solver.java
+10
-9
No files found.
src/inport/ConversionUtils/Solver.java
View file @
20b4658c
...
@@ -133,6 +133,8 @@ public class Solver {
...
@@ -133,6 +133,8 @@ public class Solver {
ProcessBuilder
pb
;
ProcessBuilder
pb
;
boolean
isResultsInOutput
;
boolean
isResultsInOutput
;
Process
solverProcess
;
switch
(
solverName
)
{
switch
(
solverName
)
{
case
Chuffed:
{
case
Chuffed:
{
pb
=
new
ProcessBuilder
(
"minizinc"
,
pb
=
new
ProcessBuilder
(
"minizinc"
,
...
@@ -140,6 +142,7 @@ public class Solver {
...
@@ -140,6 +142,7 @@ public class Solver {
constraints
,
minizincData
,
constraints
,
minizincData
,
"-o"
,
solverResults
);
"-o"
,
solverResults
);
isResultsInOutput
=
false
;
isResultsInOutput
=
false
;
solverProcess
=
pb
.
start
();
break
;
break
;
}
}
case
OrTools:
{
case
OrTools:
{
...
@@ -163,6 +166,7 @@ public class Solver {
...
@@ -163,6 +166,7 @@ public class Solver {
}
}
pb
=
new
ProcessBuilder
(
"external_tools/or-tools_flatzinc_Ubuntu-18.04-64bit_v7.2.6977/bin/fzn-or-tools"
,
pb
=
new
ProcessBuilder
(
"external_tools/or-tools_flatzinc_Ubuntu-18.04-64bit_v7.2.6977/bin/fzn-or-tools"
,
flatZincConstraints
);
flatZincConstraints
);
solverProcess
=
pb
.
start
();
break
;
break
;
}
}
case
Undefined:
{
case
Undefined:
{
...
@@ -185,7 +189,7 @@ public class Solver {
...
@@ -185,7 +189,7 @@ public class Solver {
return
""
;
return
""
;
}
}
}
}
pb
=
new
ProcessBuilder
(
flatZincSolver
,
flatZincConstraints
);
solverProcess
=
new
ProcessBuilder
(
flatZincSolver
,
flatZincConstraints
).
start
(
);
break
;
break
;
}
}
default
:
default
:
...
@@ -196,7 +200,8 @@ public class Solver {
...
@@ -196,7 +200,8 @@ public class Solver {
isDestroyed
=
false
;
isDestroyed
=
false
;
lock
.
unlock
();
lock
.
unlock
();
final
Process
process
=
pb
.
start
();
final
Process
process
=
solverProcess
;
final
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
solverProcess
.
getInputStream
()));
Thread
killer
=
new
Thread
(()
->
{
Thread
killer
=
new
Thread
(()
->
{
lock
.
lock
();
lock
.
lock
();
...
@@ -220,11 +225,9 @@ public class Solver {
...
@@ -220,11 +225,9 @@ public class Solver {
}
}
});
});
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
process
.
getInputStream
()));
// BufferedReader br2 = new BufferedReader(new InputStreamReader(process.getErrorStream()));
killer
.
start
();
killer
.
start
();
int
exitCode
=
process
.
waitFor
();
String
output
=
br
.
lines
().
collect
(
Collectors
.
joining
(
"\n"
));
int
exitCode
=
solverProcess
.
waitFor
();
lock
.
lock
();
lock
.
lock
();
try
{
try
{
...
@@ -246,12 +249,10 @@ public class Solver {
...
@@ -246,12 +249,10 @@ public class Solver {
if
(
isResultsInOutput
)
{
if
(
isResultsInOutput
)
{
try
(
FileWriter
res
=
new
FileWriter
(
solverResults
))
{
try
(
FileWriter
res
=
new
FileWriter
(
solverResults
))
{
res
.
write
(
br
.
lines
().
collect
(
Collectors
.
joining
(
"\n"
))
);
res
.
write
(
output
);
}
}
interpreter
.
accept
(
task
,
solverResults
);
interpreter
.
accept
(
task
,
solverResults
);
}
else
{
}
else
{
String
output
=
br
.
lines
().
collect
(
Collectors
.
joining
(
"\n"
));
// String errors = br.lines().collect(Collectors.joining("\n"));
// String errors = br.lines().collect(Collectors.joining("\n"));
//
//
// System.out.println("output : " + output);
// System.out.println("output : " + output);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment