Skip to content

Commit

Permalink
Merge branch 'main' into scorpion
Browse files Browse the repository at this point in the history
  • Loading branch information
jendrikseipp committed Mar 27, 2024
2 parents b28185d + 61646d7 commit b706f1f
Show file tree
Hide file tree
Showing 37 changed files with 1,283 additions and 812 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
cplex_DIR: D:\a\cplex

CPLEX_URL: "${{ secrets.CPLEX2211_WINDOWS_URL }}"
ZLIB_URL: "https://www.zlib.net/zlib13.zip"
ZLIB_URL: "https://www.zlib.net/zlib131.zip"


jobs:
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
cd zlib
echo "Set up zlib include directory"
move ../zlib-1.3 include
move ../zlib-1.3.1 include
echo "Compile zlib library"
cd include
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ contributing, and finally by last name.
- 2022-2023 Remo Christen
- 2023 Simon Dold
- 2023 Claudia S. Grundke
- 2023 Victor Paléologue
- 2023 Emanuele Tirendi
- 2021-2022 Dominik Drexler
- 2016-2020 Cedric Geissmann
Expand Down
7 changes: 0 additions & 7 deletions src/search/landmarks/landmark_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ class LandmarkFactory {

std::shared_ptr<LandmarkGraph> compute_lm_graph(const std::shared_ptr<AbstractTask> &task);

/*
TODO: Currently reasonable orders are not supported for admissible landmark count
heuristics, which is why the heuristic needs to know whether the factory computes
reasonable orders. Once issue383 is dealt with we should be able to use reasonable
orders for admissible heuristics and this method can be removed.
*/
virtual bool computes_reasonable_orders() const = 0;
virtual bool supports_conditional_effects() const = 0;

bool achievers_are_calculated() const {
Expand Down
4 changes: 0 additions & 4 deletions src/search/landmarks/landmark_factory_h_m.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1008,10 +1008,6 @@ void LandmarkFactoryHM::generate_landmarks(
postprocess(task_proxy);
}

bool LandmarkFactoryHM::computes_reasonable_orders() const {
return false;
}

bool LandmarkFactoryHM::supports_conditional_effects() const {
return false;
}
Expand Down
1 change: 0 additions & 1 deletion src/search/landmarks/landmark_factory_h_m.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ class LandmarkFactoryHM : public LandmarkFactory {
public:
explicit LandmarkFactoryHM(const plugins::Options &opts);

virtual bool computes_reasonable_orders() const override;
virtual bool supports_conditional_effects() const override;
};
}
Expand Down
9 changes: 0 additions & 9 deletions src/search/landmarks/landmark_factory_merged.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,6 @@ void LandmarkFactoryMerged::postprocess() {
lm_graph->set_landmark_ids();
}

bool LandmarkFactoryMerged::computes_reasonable_orders() const {
for (const shared_ptr<LandmarkFactory> &lm_factory : lm_factories) {
if (lm_factory->computes_reasonable_orders()) {
return true;
}
}
return false;
}

bool LandmarkFactoryMerged::supports_conditional_effects() const {
for (const shared_ptr<LandmarkFactory> &lm_factory : lm_factories) {
if (!lm_factory->supports_conditional_effects()) {
Expand Down
1 change: 0 additions & 1 deletion src/search/landmarks/landmark_factory_merged.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class LandmarkFactoryMerged : public LandmarkFactory {
public:
explicit LandmarkFactoryMerged(const plugins::Options &opts);

virtual bool computes_reasonable_orders() const override;
virtual bool supports_conditional_effects() const override;
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,6 @@ bool LandmarkFactoryReasonableOrdersHPS::effect_always_happens(
return eff.empty();
}

bool LandmarkFactoryReasonableOrdersHPS::computes_reasonable_orders() const {
return true;
}

bool LandmarkFactoryReasonableOrdersHPS::supports_conditional_effects() const {
return lm_factory->supports_conditional_effects();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class LandmarkFactoryReasonableOrdersHPS : public LandmarkFactory {
public:
LandmarkFactoryReasonableOrdersHPS(const plugins::Options &opts);

virtual bool computes_reasonable_orders() const override;
virtual bool supports_conditional_effects() const override;
};
}
Expand Down
4 changes: 0 additions & 4 deletions src/search/landmarks/landmark_factory_rpg_exhaust.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ void LandmarkFactoryRpgExhaust::generate_relaxed_landmarks(
}
}

bool LandmarkFactoryRpgExhaust::computes_reasonable_orders() const {
return false;
}

bool LandmarkFactoryRpgExhaust::supports_conditional_effects() const {
return false;
}
Expand Down
1 change: 0 additions & 1 deletion src/search/landmarks/landmark_factory_rpg_exhaust.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class LandmarkFactoryRpgExhaust : public LandmarkFactoryRelaxation {
public:
explicit LandmarkFactoryRpgExhaust(const plugins::Options &opts);

virtual bool computes_reasonable_orders() const override;
virtual bool supports_conditional_effects() const override;
};
}
Expand Down
4 changes: 0 additions & 4 deletions src/search/landmarks/landmark_factory_rpg_sasp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,6 @@ void LandmarkFactoryRpgSasp::discard_disjunctive_landmarks() {
}
}

bool LandmarkFactoryRpgSasp::computes_reasonable_orders() const {
return false;
}

bool LandmarkFactoryRpgSasp::supports_conditional_effects() const {
return true;
}
Expand Down
1 change: 0 additions & 1 deletion src/search/landmarks/landmark_factory_rpg_sasp.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class LandmarkFactoryRpgSasp : public LandmarkFactoryRelaxation {
public:
explicit LandmarkFactoryRpgSasp(const plugins::Options &opts);

virtual bool computes_reasonable_orders() const override;
virtual bool supports_conditional_effects() const override;
};
}
Expand Down
4 changes: 0 additions & 4 deletions src/search/landmarks/landmark_factory_zhu_givan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,6 @@ void LandmarkFactoryZhuGivan::add_operator_to_triggers(const OperatorProxy &op)
triggers[lm.var][lm.value].push_back(op_or_axiom_id);
}

bool LandmarkFactoryZhuGivan::computes_reasonable_orders() const {
return false;
}

bool LandmarkFactoryZhuGivan::supports_conditional_effects() const {
return true;
}
Expand Down
1 change: 0 additions & 1 deletion src/search/landmarks/landmark_factory_zhu_givan.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class LandmarkFactoryZhuGivan : public LandmarkFactoryRelaxation {
public:
explicit LandmarkFactoryZhuGivan(const plugins::Options &opts);

virtual bool computes_reasonable_orders() const override;
virtual bool supports_conditional_effects() const override;
};
}
Expand Down
28 changes: 10 additions & 18 deletions src/search/merge_and_shrink/merge_strategy_factory_sccs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,30 +74,23 @@ unique_ptr<MergeStrategy> MergeStrategyFactorySCCs::compute_merge_strategy(
break;
}

/*
Compute the indices at which the merged SCCs can be found when all
SCCs have been merged.
*/
int index = num_vars - 1;
log << "SCCs of the causal graph:" << endl;
if (log.is_at_least_normal()) {
log << "SCCs of the causal graph:" << endl;
}
vector<vector<int>> non_singleton_cg_sccs;
vector<int> indices_of_merged_sccs;
indices_of_merged_sccs.reserve(sccs.size());
for (const vector<int> &scc : sccs) {
log << scc << endl;
if (log.is_at_least_normal()) {
log << scc << endl;
}
int scc_size = scc.size();
if (scc_size == 1) {
indices_of_merged_sccs.push_back(scc.front());
} else {
index += scc_size - 1;
indices_of_merged_sccs.push_back(index);
if (scc_size != 1) {
non_singleton_cg_sccs.push_back(scc);
}
}
if (sccs.size() == 1) {
if (log.is_at_least_normal() && sccs.size() == 1) {
log << "Only one single SCC" << endl;
}
if (static_cast<int>(sccs.size()) == num_vars) {
if (log.is_at_least_normal() && static_cast<int>(sccs.size()) == num_vars) {
log << "Only singleton SCCs" << endl;
assert(non_singleton_cg_sccs.empty());
}
Expand All @@ -111,8 +104,7 @@ unique_ptr<MergeStrategy> MergeStrategyFactorySCCs::compute_merge_strategy(
task_proxy,
merge_tree_factory,
merge_selector,
move(non_singleton_cg_sccs),
move(indices_of_merged_sccs));
move(non_singleton_cg_sccs));
}

bool MergeStrategyFactorySCCs::requires_init_distances() const {
Expand Down
31 changes: 19 additions & 12 deletions src/search/merge_and_shrink/merge_strategy_sccs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,53 @@ MergeStrategySCCs::MergeStrategySCCs(
const TaskProxy &task_proxy,
const shared_ptr<MergeTreeFactory> &merge_tree_factory,
const shared_ptr<MergeSelector> &merge_selector,
vector<vector<int>> non_singleton_cg_sccs,
vector<int> indices_of_merged_sccs)
vector<vector<int>> &&non_singleton_cg_sccs)
: MergeStrategy(fts),
task_proxy(task_proxy),
merge_tree_factory(merge_tree_factory),
merge_selector(merge_selector),
non_singleton_cg_sccs(move(non_singleton_cg_sccs)),
indices_of_merged_sccs(move(indices_of_merged_sccs)),
current_merge_tree(nullptr) {
}

MergeStrategySCCs::~MergeStrategySCCs() {
}

pair<int, int> MergeStrategySCCs::get_next() {
// We did not already start merging an SCC/all finished SCCs, so we
// do not have a current set of indices we want to finish merging.
if (current_ts_indices.empty()) {
// Get the next indices we need to merge
/*
We are currently not dealing with merging all factors of an SCC, so
we need to either get the next one or allow merging any existing
factors of the FTS if there is no SCC left.
*/
if (non_singleton_cg_sccs.empty()) {
assert(indices_of_merged_sccs.size() > 1);
current_ts_indices = move(indices_of_merged_sccs);
// We are done dealing with all SCCs, allow merging any factors.
current_ts_indices.reserve(fts.get_num_active_entries());
for (int ts_index: fts) {
current_ts_indices.push_back(ts_index);
}
} else {
/*
There is another SCC we have to deal with. Store its factors so
that we merge them over the next iterations.
*/
vector<int> &current_scc = non_singleton_cg_sccs.front();
assert(current_scc.size() > 1);
current_ts_indices = move(current_scc);
non_singleton_cg_sccs.erase(non_singleton_cg_sccs.begin());
}

// If using a merge tree factory, compute a merge tree for this set
// If using a merge tree factory, compute a merge tree for this set.
if (merge_tree_factory) {
current_merge_tree = merge_tree_factory->compute_merge_tree(
task_proxy, fts, current_ts_indices);
}
} else {
// Add the most recent merge to the current indices set
// Add the most recent product to the current index set.
current_ts_indices.push_back(fts.get_size() - 1);
}

// Select the next merge for the current set of indices, either using the
// Select the next merge from the current index set, either using the
// tree or the selector.
pair<int, int > next_pair;
int merged_ts_index = fts.get_size();
Expand All @@ -72,7 +79,7 @@ pair<int, int> MergeStrategySCCs::get_next() {
next_pair = merge_selector->select_merge(fts, current_ts_indices);
}

// Remove the two merged indices from the current set of indices.
// Remove the two merged indices from the current index set.
for (vector<int>::iterator it = current_ts_indices.begin();
it != current_ts_indices.end();) {
if (*it == next_pair.first || *it == next_pair.second) {
Expand Down
5 changes: 1 addition & 4 deletions src/search/merge_and_shrink/merge_strategy_sccs.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ class MergeStrategySCCs : public MergeStrategy {
std::shared_ptr<MergeTreeFactory> merge_tree_factory;
std::shared_ptr<MergeSelector> merge_selector;
std::vector<std::vector<int>> non_singleton_cg_sccs;
std::vector<int> indices_of_merged_sccs;

// Active "merge strategies" while merging a set of indices
std::unique_ptr<MergeTree> current_merge_tree;
std::vector<int> current_ts_indices;
public:
Expand All @@ -28,8 +26,7 @@ class MergeStrategySCCs : public MergeStrategy {
const TaskProxy &task_proxy,
const std::shared_ptr<MergeTreeFactory> &merge_tree_factory,
const std::shared_ptr<MergeSelector> &merge_selector,
std::vector<std::vector<int>> non_singleton_cg_sccs,
std::vector<int> indices_of_merged_sccs);
std::vector<std::vector<int>> &&non_singleton_cg_sccs);
virtual ~MergeStrategySCCs() override;
virtual std::pair<int, int> get_next() override;
};
Expand Down
3 changes: 1 addition & 2 deletions src/search/planner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@ int main(int argc, const char **argv) {
} else if (search_algorithm->get_status() == UNSOLVABLE) {
exitcode = ExitCode::SEARCH_UNSOLVABLE;
}
utils::report_exit_code_reentrant(exitcode);
return static_cast<int>(exitcode);
exit_with(exitcode);
}
8 changes: 3 additions & 5 deletions src/search/utils/system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,9 @@ void exit_with(ExitCode exitcode) {
exit(static_cast<int>(exitcode));
}

void exit_after_receiving_signal(ExitCode exitcode) {
/*
In signal handlers, we have to use the "safe function" _Exit() rather
than the unsafe function exit().
*/
void exit_with_reentrant(ExitCode exitcode) {
/* In signal handlers or when we run out of memory, we have to use the
"safe function" _Exit() rather than the unsafe function exit(). */
report_exit_code_reentrant(exitcode);
_Exit(static_cast<int>(exitcode));
}
Expand Down
2 changes: 1 addition & 1 deletion src/search/utils/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ enum class ExitCode {
};

NO_RETURN extern void exit_with(ExitCode returncode);
NO_RETURN extern void exit_after_receiving_signal(ExitCode returncode);
NO_RETURN extern void exit_with_reentrant(ExitCode returncode);

int get_peak_memory_in_kb();
const char *get_exit_code_message_reentrant(ExitCode exitcode);
Expand Down
4 changes: 2 additions & 2 deletions src/search/utils/system_unix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static void out_of_memory_handler() {
memory for the stack of the signal handler and raising a signal here.
*/
write_reentrant_str(STDOUT_FILENO, "Failed to allocate memory.\n");
exit_with(ExitCode::SEARCH_OUT_OF_MEMORY);
exit_with_reentrant(ExitCode::SEARCH_OUT_OF_MEMORY);
}

static void signal_handler(int signal_number) {
Expand All @@ -173,7 +173,7 @@ static void signal_handler(int signal_number) {
write_reentrant_int(STDOUT_FILENO, signal_number);
write_reentrant_str(STDOUT_FILENO, " -- exiting\n");
if (signal_number == SIGXCPU) {
exit_after_receiving_signal(ExitCode::SEARCH_OUT_OF_TIME);
exit_with_reentrant(ExitCode::SEARCH_OUT_OF_TIME);
}
raise(signal_number);
}
Expand Down
2 changes: 1 addition & 1 deletion src/search/utils/system_windows.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ using namespace std;
namespace utils {
void out_of_memory_handler() {
cout << "Failed to allocate memory." << endl;
exit_with(ExitCode::SEARCH_OUT_OF_MEMORY);
exit_with_reentrant(ExitCode::SEARCH_OUT_OF_MEMORY);
}

void signal_handler(int signal_number) {
Expand Down
Loading

0 comments on commit b706f1f

Please sign in to comment.