Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion include/PetriEngine/PQL/Contexts.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,18 @@ namespace PetriEngine {

SimplificationContext(const MarkVal* marking,
const PetriNet* net, uint32_t queryTimeout, uint32_t lpTimeout,
Simplification::LPCache* cache, uint32_t potencyTimeout = 0)
Simplification::LPCache* cache, uint32_t potencyTimeout = 0, uint32_t printLevel = 0, bool useBigM = true)
: _queryTimeout(queryTimeout), _lpTimeout(lpTimeout),
_potencyTimeout(potencyTimeout) {
_negated = false;
_useBigM = useBigM;
_marking = marking;
_net = net;
_base_lp = buildBase();
_start = std::chrono::high_resolution_clock::now();
_cache = cache;
_markingOutOfBounds = false;
_printLevel = printLevel;
for(size_t i = 0; i < net->numberOfPlaces(); ++i) {
if (marking[i] > std::numeric_limits<int32_t>::max()) { //too many tokens exceeding int32_t limits, LP solver will give wrong results
_markingOutOfBounds = true;
Expand Down Expand Up @@ -230,6 +232,14 @@ namespace PetriEngine {

double getReductionTime();

uint32_t getPrintLevel() const{
return _printLevel;
}

bool useBigM() const {
return _useBigM;
}

bool timeout() const {
auto end = std::chrono::high_resolution_clock::now();
auto diff = std::chrono::duration_cast<std::chrono::seconds>(end - _start);
Expand All @@ -254,10 +264,12 @@ namespace PetriEngine {

private:
bool _negated;
bool _useBigM;
const MarkVal* _marking;
bool _markingOutOfBounds;
const PetriNet* _net;
uint32_t _queryTimeout, _lpTimeout, _potencyTimeout;
uint32_t _printLevel;
mutable glp_prob* _base_lp = nullptr;
std::chrono::high_resolution_clock::time_point _start;
Simplification::LPCache* _cache;
Expand Down
1 change: 1 addition & 0 deletions include/PetriEngine/Simplification/Member.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <functional>
#include <cassert>
#include <cstring>
#include <cstdint>
//#include "../PQL/PQL.h"

namespace PetriEngine {
Expand Down
2 changes: 2 additions & 0 deletions include/PetriEngine/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ struct options_t {
std::set<size_t> querynumbers;
Strategy strategy = Strategy::DEFAULT;
int queryReductionTimeout = 30, intervalTimeout = 10, partitionTimeout = 5, lpsolveTimeout = 10, initPotencyTimeout = 10;
bool lpUseBigM = true;
int lpPrintLevel = 0;
TraceLevel trace = TraceLevel::None;
bool use_query_reductions = true;
uint32_t siphontrapTimeout = 0;
Expand Down
1 change: 1 addition & 0 deletions include/utils/structures/shared_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <string>
#include <memory>
#include <algorithm>
#include <cstdint>

typedef const std::string const_string;
typedef std::shared_ptr<const_string> shared_const_string;
Expand Down
20 changes: 20 additions & 0 deletions src/PetriEngine/PQL/Contexts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,26 @@ namespace PetriEngine {
return nullptr;
}
}

/*glp_add_rows(lp, _net->numberOfPlaces());
for (size_t p = 0; p < _net->numberOfPlaces(); p++) {
std::vector<double> row(nCol+1, 0);
std::vector<int> indices(1, 0);
row.shrink_to_fit();

for (size_t t = 0; t < _net->numberOfTransitions(); t++) {
if(_net->outArc(t, p) - _net->inArc(p, t) != 0){
row[t+1] = _net->outArc(t, p);
row[t+1] -= _net->inArc(p, t);
indices.push_back(t+1);
}
}

glp_set_mat_row(lp, rowno, indices.size() - 1, indices.data(), row.data());
glp_set_row_bnds(lp, rowno, GLP_LO, -1.0 * marking()[p], infty);
++rowno;
}*/

return lp;
}
}
Expand Down
Loading
Loading