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
74768a32
Commit
74768a32
authored
Oct 14, 2021
by
ehebrard
Browse files
valgrind
parent
35736103
Changes
1
Hide whitespace changes
Inline
Side-by-side
examples/src/solve.cpp
0 → 100644
View file @
74768a32
/*************************************************************************
minicsp
Copyright 2010--2011 George Katsirelos
Minicsp is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
Minicsp is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with minicsp. If not, see <http://www.gnu.org/licenses/>.
*************************************************************************/
// #include "DistanceVariable.hpp"
#include
"BellmanFord.hpp"
#include
"DistanceGraph.hpp"
#include
"SparseDistanceGraph.hpp"
#include
"TimeTabling.hpp"
#include
"osp.hpp"
using
namespace
std
;
using
namespace
schedcl
;
int
main
(
int
argc
,
char
*
argv
[])
{
vector
<
int
>
duration
;
vector
<
vector
<
int
>>
resource
;
osp
::
read_instance
(
"j3-per0-1.txt"
,
duration
,
resource
);
cout
<<
duration
.
size
()
<<
" tasks:"
;
for
(
auto
d
:
duration
)
{
cout
<<
" "
<<
d
;
}
cout
<<
endl
;
cout
<<
resource
.
size
()
<<
" resources:"
;
for
(
auto
R
:
resource
)
{
cout
<<
" ("
;
for
(
auto
x
:
R
)
{
cout
<<
" "
<<
x
;
}
cout
<<
")"
;
}
cout
<<
endl
;
Schedule
<
int
>
S
;
for
(
auto
d
:
duration
)
{
S
.
addTask
(
"t"
+
to_string
(
S
.
numTask
()),
d
,
d
);
}
// vector<CumulativeTimeTabling<int, int> *> cons;
for
(
auto
&
R
:
resource
)
{
vector
<
int
>
demand
(
R
.
size
(),
1
);
auto
con
=
new
CumulativeTimeTabling
<
int
,
int
>
(
S
,
R
.
begin
(),
R
.
end
(),
demand
.
begin
(),
demand
.
end
(),
1
);
S
.
post
(
con
);
// for (auto x : R) {
// for (auto y : R)
// if (x != y) {
// S.addEdge(START(x), START(y));
// S.addEdge(START(x), END(y));
// S.addEdge(END(x), START(y));
// S.addEdge(END(x), END(y));
// S2.addEdge(START(x), START(y));
// S2.addEdge(START(x), END(y));
// S2.addEdge(END(x), START(y));
// S2.addEdge(END(x), END(y));
// }
// }
con
->
debug_flag
=
true
;
}
auto
ub
{
osp
::
getUb
(
duration
,
resource
)};
// S.setUpperBound(ub);
S
.
setUpperBound
(
1250
);
// 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);
// cout << SG << endl;
// DistanceGraph<int> G(S2);
// cout << G << endl;
// G.FloydWarshall();
// cout << G << endl;
// BellmanFord<int> BF(SG.size());
// 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;
S
.
initialise
();
cout
<<
S
<<
endl
;
// S.updateDistances();
//
// cout << S << endl;
S
.
search
();
}
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