Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Capacitated Vehicule Routing Problem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Victor Ruelle
Capacitated Vehicule Routing Problem
Commits
435487d4
Commit
435487d4
authored
6 years ago
by
Victor Ruelle
Browse files
Options
Downloads
Patches
Plain Diff
Add new file
parent
c803d862
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
debugging.py
+55
-0
55 additions, 0 deletions
debugging.py
with
55 additions
and
0 deletions
debugging.py
0 → 100644
+
55
−
0
View file @
435487d4
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 26 13:43:04 2018
@author: GVKD1542
"""
from
cap_constraint
import
find_components
from
globals
import
*
def
show_x
(
instance
):
expr
=
"
"
for
j
in
instance
.
nodes
:
expr
+=
str
(
j
)
+
"
"
print
(
expr
)
for
i
in
instance
.
nodes
:
expr
=
""
expr
+=
str
(
i
)
+
"
"
for
j
in
range
(
i
):
expr
+=
(
str
(
(
round
(
instance
.
x
[
i
,
j
].
value
,
2
)
))
if
instance
.
x
[
i
,
j
].
value
>
eps
else
"
-.-
"
)
+
"
"
print
(
expr
)
def
explore_x
(
instance
,
i
):
sum
=
0
for
j
in
instance
.
nodes
:
a
,
b
=
(
max
(
i
,
j
),
min
(
i
,
j
))
if
(
a
==
b
):
continue
print
(
str
(
j
)
+
"
:
"
+
str
(
round
(
instance
.
x
[
a
,
b
].
value
,
4
))
+
"
"
)
sum
+=
instance
.
x
[
a
,
b
].
value
print
()
print
(
"
total :
"
+
str
(
sum
))
def
show_routes
(
instance
):
print
()
print
(
"
showing routes for found solution with capacity
"
+
str
(
instance
.
capacity
.
value
)
+
"
and
"
+
str
(
instance
.
number_of_vehicles
.
value
)
+
"
vehicles
"
)
print
()
comp
=
find_components
(
instance
)
for
c
in
comp
:
expr
=
"
0
"
pred
=
0
total_load
=
0
total_cost
=
0
for
node
in
c
:
total_cost
+=
instance
.
costs
[
pred
,
node
]
total_load
+=
instance
.
demands
[
node
]
expr
+=
"
--
"
+
str
(
round
(
instance
.
costs
[
pred
,
node
],
2
))
+
"
-->
"
expr
+=
str
(
node
)
+
"
(
"
expr
+=
str
(
instance
.
demands
[
node
])
+
"
)
"
pred
=
node
expr
+=
"
--> 0
"
print
(
expr
)
print
(
"
total load :
"
+
str
(
total_load
)
+
"
and total cost :
"
+
str
(
total_cost
))
print
()
\ No newline at end of file
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