Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gtsp-heuristics
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
Guilhem Saurel
gtsp-heuristics
Commits
44c6f631
Commit
44c6f631
authored
8 months ago
by
Florent Lamiraux
Browse files
Options
Downloads
Patches
Plain Diff
[c+=] Replace array by vector.
parent
4092f58e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/gtsp.cpp
+1
-1
1 addition, 1 deletion
src/gtsp.cpp
src/gtsp.hpp
+3
-2
3 additions, 2 deletions
src/gtsp.hpp
with
4 additions
and
3 deletions
src/gtsp.cpp
+
1
−
1
View file @
44c6f631
...
...
@@ -125,7 +125,7 @@ bool Gtsp::isTriangularInequalitySatisfied() {
Tour
::
Tour
(
const
Gtsp
&
pb
)
:
problem
(
pb
)
{
cost
=
0
;
int
prev
=
problem
.
getNode
(
0
,
0
);
nodes
=
new
int
[
problem
.
getNbClusters
()
]
;
nodes
.
resize
(
problem
.
getNbClusters
()
)
;
nodes
[
0
]
=
problem
.
getNode
(
0
,
0
);
for
(
int
i
=
1
;
i
<
problem
.
getNbClusters
();
i
++
)
{
//std::cout << " arc " << prev << "->" << problem.getNode(i,0) << " cost=" << problem.getDist(prev,problem.getNode(i,0)) ;
...
...
This diff is collapsed.
Click to expand it.
src/gtsp.hpp
+
3
−
2
View file @
44c6f631
...
...
@@ -25,6 +25,7 @@
#define INCLUDED_GTSP_HPP
#include
<list>
#include
<vector>
// class Gtsp: stores the instance data
class
Gtsp
{
...
...
@@ -54,10 +55,10 @@ class Tour {
const
Gtsp
&
problem
;
// reference to the problem
double
cost
;
// cost of the tour
int
*
nodes
;
// nodes[i] -> id of node at position i in the tour
std
::
vector
<
int
>
nodes
;
// nodes[i] -> id of node at position i in the tour
public:
Tour
(
const
Gtsp
&
);
// constructor from a problem -> create a Tour made of the first node of each cluster
~
Tour
()
{
delete
[]
nodes
;
};
// destructor
~
Tour
()
{};
// destructor
double
getCost
();
// get the tour cost
void
setCost
(
double
);
// set the tour cost
int
getNodeAtPos
(
int
);
// get the id of the node at position i
...
...
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