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 8dc87192
authored
Jul 14, 2023
by
张晓
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-dispatch-zx' into develop
2 parents
9c33ead4
1c155e9b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
6 deletions
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/SolveServiceImpl.java
project-dispatch/src/test/java/com/dituhui/pea/dispatch/SolveServiceTest.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/SolveServiceImpl.java
View file @
8dc8719
...
...
@@ -66,7 +66,6 @@ public class SolveServiceImpl implements SolveService {
private
EntityManager
entityManager
;
@Autowired
ExtractService
extractService
;
...
...
@@ -157,11 +156,8 @@ public class SolveServiceImpl implements SolveService {
Depot
depot
=
new
Depot
(
engineer
.
getId
(),
engineer
.
getEngineerCode
(),
location
,
60
*
8
,
60
*
18
);
depotList
.
add
(
depot
);
// log.debug("组织问题对象, technicianList groupId:{}, batchNo:{}, engineer-code:{}", groupId, batchNo, engineer.getEngineerCode());
List
<
String
>
skillList
=
queryEngineerSkills
(
engineer
.
getEngineerCode
());
// log.debug("组织问题对象, technicianList groupId:{}, batchNo:{}, engineer-code:{} , skills:{}", groupId, batchNo, engineer.getEngineerCode(), String.join(";", skillList));
// 距离偏好map
Map
<
String
,
Long
>
preferedLoctionDistanceMap
=
new
HashMap
<
String
,
Long
>();
customerList
.
forEach
(
customer
->
{
...
...
@@ -180,9 +176,9 @@ public class SolveServiceImpl implements SolveService {
//locationlist
List
<
Location
>
locationList
=
Stream
.
concat
(
depotList
.
stream
().
map
(
Depot:
:
getLocation
),
customerList
.
stream
().
map
(
Customer:
:
getLocation
)).
collect
(
Collectors
.
toList
());
distanceCalculator
.
initDistanceMaps
(
locationList
);
DispatchSolution
solution
=
new
DispatchSolution
(
groupId
,
batchNo
,
locationList
,
oneDepot
,
technicianList
,
customerList
);
distanceCalculator
.
initDistanceMaps
(
locationList
);
log
.
info
(
"组织问题对象 done, groupId:{}, batchNo:{}, technician-size:{}, customer-size:{}, location-size:{}"
,
groupId
,
batchNo
,
technicianList
.
size
(),
customerList
.
size
(),
locationList
.
size
());
...
...
project-dispatch/src/test/java/com/dituhui/pea/dispatch/SolveServiceTest.java
View file @
8dc8719
...
...
@@ -50,7 +50,7 @@ class SolveServiceTest {
SolverConfig
solverConfig
=
new
SolverConfig
().
withSolutionClass
(
DispatchSolution
.
class
);
solverConfig
.
withEntityClassList
(
Arrays
.
asList
(
Technician
.
class
,
Customer
.
class
));
// 这里不能漏掉,否则约束不生效
solverConfig
.
withConstraintProviderClass
(
DispatchConstraintProvider
.
class
);
solverConfig
.
withTerminationSpentLimit
(
Duration
.
ofSeconds
(
1
0
));
solverConfig
.
withTerminationSpentLimit
(
Duration
.
ofSeconds
(
2
0
));
SolverFactory
<
DispatchSolution
>
solverFactory
=
SolverFactory
.
create
(
solverConfig
);
solver
=
solverFactory
.
buildSolver
();
...
...
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