Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SAEV Greedy Fleet Sizing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Romain BERNARD
SAEV Greedy Fleet Sizing
Commits
27ac6610
Commit
27ac6610
authored
1 year ago
by
Romain BERNARD
Committed by
Romain BERNARD
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
shortest path container implementation
parent
b23d56c5
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
Transit algorithm implementation
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ShortestPath/Transit/TransitShortestPathContainer.cpp
+4
-3
4 additions, 3 deletions
src/ShortestPath/Transit/TransitShortestPathContainer.cpp
src/ShortestPath/Transit/TransitShortestPathContainer.h
+4
-1
4 additions, 1 deletion
src/ShortestPath/Transit/TransitShortestPathContainer.h
with
8 additions
and
4 deletions
src/ShortestPath/Transit/TransitShortestPathContainer.cpp
+
4
−
3
View file @
27ac6610
...
...
@@ -3,6 +3,7 @@
//
#include
"TransitShortestPathContainer.h"
#include
"TransitStateContainer.h"
void
TransitShortestPathContainer
::
addShortestPathCollection
(
int
startNodeIndex
,
const
std
::
pair
<
int
,
std
::
vector
<
TransitShortestPath
>>&
shortestPathList
)
{
...
...
@@ -10,13 +11,13 @@ void TransitShortestPathContainer::addShortestPathCollection(int startNodeIndex,
}
void
TransitShortestPathContainer
::
addShortestPathCollection
(
int
startNodeIndex
,
int
startingInstant
,
int
graphSize
,
const
std
::
vector
<
TransitAlgorithmState
>
&
algorithmResultStates
)
{
const
TransitStateContainer
&
algorithmResultStates
)
{
std
::
vector
<
TransitShortestPath
>
shortestPathList
;
shortestPathList
.
reserve
(
graphSize
);
//Convert states to shortest paths and add to collection
for
(
const
auto
&
state
:
algorithmResultStates
)
{
shortestPathList
.
emplace_back
(
state
);
for
(
int
i
=
0
;
i
<
graphSize
;
++
i
)
{
shortestPathList
.
emplace_back
(
algorithmResultStates
.
getBestSolution
(
i
)
);
}
//Add the (startingInstant, pathVector) pair at the appropriate node index
...
...
This diff is collapsed.
Click to expand it.
src/ShortestPath/Transit/TransitShortestPathContainer.h
+
4
−
1
View file @
27ac6610
...
...
@@ -8,14 +8,17 @@
#include
<vector>
#include
"TransitShortestPath.h"
#include
"TransitStateContainer.h"
class
TransitShortestPathContainer
{
private:
std
::
vector
<
std
::
vector
<
std
::
pair
<
int
,
std
::
vector
<
TransitShortestPath
>>>>
container
;
//NodeVector< PairVector<Pair<Instant, NodeVector<ShortestPath> >> >
public:
explicit
TransitShortestPathContainer
(
int
size
)
{
container
.
resize
(
size
);
}
explicit
TransitShortestPathContainer
(
size_t
size
)
{
container
.
resize
(
size
);
}
void
addShortestPathCollection
(
int
startNodeIndex
,
const
std
::
pair
<
int
,
std
::
vector
<
TransitShortestPath
>>&
shortestPathList
);
void
addShortestPathCollection
(
int
startNodeIndex
,
int
startingInstant
,
int
graphSize
,
const
std
::
vector
<
TransitAlgorithmState
>
&
algorithmResultStates
);
void
addShortestPathCollection
(
int
startNodeIndex
,
int
startingInstant
,
int
graphSize
,
const
TransitStateContainer
&
algorithmResultStates
);
std
::
vector
<
std
::
pair
<
int
,
std
::
vector
<
TransitShortestPath
>>>::
iterator
getShortestPathsFromTime
(
int
startNodeIndex
,
int
earliestStartInstant
);
std
::
pair
<
int
,
TransitShortestPath
>
getShortestPathToYFromTime
(
int
startNodeIndex
,
int
earliestStartInstant
,
int
goalNode
);
...
...
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