Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Emmanuel Hebrard
SchedCL
Commits
68c7a036
Commit
68c7a036
authored
Oct 22, 2021
by
ehebrard
Browse files
bug
parent
50c5bc2e
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
examples/src/solve.cpp
View file @
68c7a036
...
...
@@ -80,45 +80,45 @@ int main(int argc, char *argv[]) {
}
auto
ub
{
osp
::
getUb
(
duration
,
resource
)};
//
S.setUpperBound(ub);
S
.
setUpperBound
(
1250
);
// S.setUpperBound(1126);
S
.
setUpperBound
(
ub
);
//
S.setUpperBound(1250);
// S.setUpperBound(1126);
// vector<task> scope;
// vector<int> demand;
// for (auto &job : resource) {
// demand.resize(job.size(), 1);
// for (auto j : job)
// scope.push_back(j);
// vector<task> scope;
// vector<int> demand;
// for (auto &job : resource) {
// demand.resize(job.size(), 1);
// for (auto j : job)
// scope.push_back(j);
// SparseDistanceGraph<int> SG(S);
// SparseDistanceGraph<int> SG(S);
// cout << SG << endl;
// cout << SG << endl;
// DistanceGraph<int> G(S2);
// DistanceGraph<int> G(S2);
// cout << G << endl;
// cout << G << endl;
// G.FloydWarshall();
// G.FloydWarshall();
// cout << G << endl;
// cout << G << endl;
// BellmanFord<int> BF(SG.size());
// BellmanFord<int> BF(SG.size());
// vector<int> shortest_path(S.numEvent(), numeric_limits<int>::max());
//
// BF.allShortestPaths(ORIGIN, SG.successor, shortest_path);
// vector<int> shortest_path(S.numEvent(), numeric_limits<int>::max());
//
// BF.allShortestPaths(ORIGIN, SG.successor, shortest_path);
// for(auto v{0}; v<S.numEvent(); ++v)
// cout << S.label(v) << ": " << shortest_path[v] << endl;
// for(auto v{0}; v<S.numEvent(); ++v)
// cout << S.label(v) << ": " << shortest_path[v] << endl;
S
.
initialise
();
S
.
initialise
();
cout
<<
S
<<
endl
;
//
cout << S << endl;
// S.updateDistances();
//
// cout << S << endl;
// S.updateDistances();
//
// cout << S << endl;
S
.
search
();
S
.
search
();
}
src/header/BellmanFord.hpp
View file @
68c7a036
...
...
@@ -90,16 +90,10 @@ void BellmanFord<T>::allShortestPaths(const int s, const G& neighbors, vector<T>
shortest_path
[
v
]
=
shortest_path
[
u
]
+
w
;
// cout << " (" << shortest_path[v] << ")";
if
(
not
changed
.
has
(
v
))
changed
.
add
(
v
);
// if(not reached.has(v))
// reached.add(v);
}
}
// cout << endl;
}
}
...
...
src/header/DistanceVariable.hpp
View file @
68c7a036
...
...
@@ -12,10 +12,6 @@ namespace schedcl {
using
event
=
int
;
using
namespace
std
;
//
// template <typename T>
// class DistanceVariable ;
template
<
typename
T
>
class
Schedule
;
template
<
typename
T
>
class
DistanceVariable
;
...
...
@@ -39,15 +35,6 @@ public:
}
};
// class DistanceLiteral {
//
// public:
//
// int var{-1};
// int bound{-1};
//
// };
/* Explanation system:
An Explainer is a class with the methods 'xplain(const DistanceLiteral& d, vector<Literal>& Cl)' that inserts an explanation for the literal d to the clause Cl
...
...
@@ -153,6 +140,8 @@ public:
// get the current distance
T
get
()
const
{
return
literals
.
back
().
value
;
}
const
Bound
<
T
>
&
back
()
const
{
return
literals
.
back
();
}
const
Bound
<
T
>
&
get
(
const
int
l
)
const
{
return
literals
[
l
];
}
// set the new distance to 'd'
...
...
src/header/Schedule.hpp
View file @
68c7a036
This diff is collapsed.
Click to expand it.
src/header/SparseGraph.hpp
View file @
68c7a036
...
...
@@ -72,7 +72,8 @@ public:
size_t
size
()
const
;
SparseGraph
();
void
initialise
(
Schedule
<
T
>
&
s
);
// void initialise(Schedule<T> &s);
void
initialise
(
const
int
n
);
// restore to the last saved state (restore vertex merging, Arc weights
// are
...
...
@@ -147,13 +148,55 @@ template <typename T> void SparseGraph<T>::addArc(DistanceVariable<T> *v) {
++
numArc
;
}
template
<
typename
T
>
void
SparseGraph
<
T
>::
initialise
(
Schedule
<
T
>
&
sched
)
{
cout
<<
"INIT GRAPH
\n
"
;
auto
n
{
sched
.
numEvent
()};
// template <typename T> void SparseGraph<T>::initialise(Schedule<T> &sched, const bool init_arcs) {
//
// // cout << "INIT GRAPH\n";
//
// auto n{sched.numEvent()};
//
// auto old_n{vertexCount()};
//
// if (n > 0) {
//
// buffer.resize(n, 0);
//
// neighbor[PREDECESSOR].resize(n);
// neighbor[SUCCESSOR].resize(n);
//
// if(init_arcs) {
// assert(numArc == 0);
// for (auto i{numArc}; i < sched.variables.size(); ++i) {
//
// auto v{sched.variables[i]};
//
// assert(v->from >= 0 and v->from < n);
// assert(v->to >= 0 and v->to < n);
//
// addArc(v);
// }
// }
//
// vertices.reserve(n);
// vertices.fill();
// representant.resize(n);
// // tail.resize(n);
// // next.resize(n);
// // prev.resize(n);
//
// for (auto i = old_n; i < n; ++i) {
// representant[i]
// // = tail[i] = next[i] = prev[i]
// = i;
// }
// }
//
// #ifdef DEBUG_SG
// cout << *this << endl;
// verify("init");
// #endif
// }
auto
old_n
{
vertexCount
()};
template
<
typename
T
>
void
SparseGraph
<
T
>::
initialise
(
const
int
n
)
{
if
(
n
>
0
)
{
...
...
@@ -162,25 +205,11 @@ template <typename T> void SparseGraph<T>::initialise(Schedule<T> &sched) {
neighbor
[
PREDECESSOR
].
resize
(
n
);
neighbor
[
SUCCESSOR
].
resize
(
n
);
// for (auto v : sched.variables) {
for
(
auto
i
{
numArc
};
i
<
sched
.
variables
.
size
();
++
i
)
{
auto
v
{
sched
.
variables
[
i
]};
assert
(
v
->
from
>=
0
and
v
->
from
<
n
);
assert
(
v
->
to
>=
0
and
v
->
to
<
n
);
addArc
(
v
);
}
vertices
.
reserve
(
n
);
vertices
.
fill
();
representant
.
resize
(
n
);
// tail.resize(n);
// next.resize(n);
// prev.resize(n);
for
(
auto
i
=
old_n
;
i
<
n
;
++
i
)
{
for
(
auto
i
=
0
;
i
<
n
;
++
i
)
{
representant
[
i
]
// = tail[i] = next[i] = prev[i]
=
i
;
...
...
src/header/TimeTabling.hpp
View file @
68c7a036
...
...
@@ -467,10 +467,6 @@ void CumulativeTimeTabling<T, C>::propagate() {
<<
offset_after_event
<<
" units of time after that event"
<<
std
::
endl
;
}
// cout << "#updt: " <<
// dynamic_cast<DenseDifferenceSystem<T>*>(m_schedule.getGraph())->numupdate
// << endl;
#endif
assert
(
TASK
(
i
)
!=
e
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
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 comment