Commit 74768a32 authored by ehebrard's avatar ehebrard
Browse files

valgrind

parent 35736103
/*************************************************************************
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();
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment