Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4e64e02a
authored
Jul 10, 2023
by
chamberone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 提交测试代码
1 parent
68e3475f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
project-dispatch/src/test/java/com/dituhui/pea/dispatch/test/Test.java
project-dispatch/src/test/java/com/dituhui/pea/dispatch/test/Test.java
0 → 100644
View file @
4e64e02
package
com
.
dituhui
.
pea
.
dispatch
.
test
;
import
java.io.FileNotFoundException
;
import
java.io.UncheckedIOException
;
import
org.optaplanner.core.api.solver.Solver
;
import
org.optaplanner.core.api.solver.SolverFactory
;
import
org.optaplanner.core.impl.solver.DefaultSolverFactory
;
import
com.dituhui.pea.dispatch.eventListener.DispatchSolverEventListener
;
import
com.dituhui.pea.dispatch.pojo.DispatchSolution
;
import
com.dituhui.pea.dispatch.utils.DataUtils
;
import
com.dituhui.pea.dispatch.utils.DispatchSolutionUtils
;
public
class
Test
{
public
static
void
main
(
String
[]
args
)
throws
UncheckedIOException
,
FileNotFoundException
{
// 创建解决方案对象
DispatchSolution
problem
=
DataUtils
.
getInitialProblem
();
// 创建求解器
DefaultSolverFactory
<
DispatchSolution
>
solverFactory
=
DispatchSolutionUtils
.
getSolverFactory
(
3
,
30
);
Solver
<
DispatchSolution
>
solver
=
solverFactory
.
buildSolver
();
// 得分监听器
solver
.
addEventListener
(
new
DispatchSolverEventListener
());
// 求解
DispatchSolution
solution
=
solver
.
solve
(
problem
);
// 打印和输出solution
DispatchSolutionUtils
.
printSolution
(
solution
);
// DispatchSolutionUtils.explainSolutionConstraintDetail(solution);
// DispatchSolutionUtils.exportSolutionJson(solution, "dispatchSolution.json");
// DispatchSolutionUtils.exportMapHtml(solution, "dispatchMap" +
// System.currentTimeMillis());
// FIXME
DispatchSolution
movedSolution
=
DispatchSolutionUtils
.
moveCustomer
(
solverFactory
,
solution
,
solution
.
getTechnicianList
().
get
(
0
),
0
,
1
);
DispatchSolutionUtils
.
printSolution
(
movedSolution
);
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment