https://hal.archives-ouvertes.fr/hal-03445821
rs.c
/*
Copyright Universite de Versailles Saint-Quentin en Yvelines 2009
AUTHORS: Sebastien Briais, Sid Touati
This file is part of RS.
RS is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
RS 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with RS. If not, see
<http://www.gnu.org/licenses/>.
*/
#include "rs.h"
#include "greedy.h"
#include "exact.h"
int RS_estimate_saturation(GDD_DAG *ddag, const char *type, int fast) {
return RS_ddag_estimate_saturation(ddag, type, fast);
}
int RS_estimate_saturation_TC(SCEDA_Graph *ddg, const char *type, int fast) {
GDD_DAG *ddag = GDD_dag_create(ddg);
if(ddag != NULL) {
int rs = RS_estimate_saturation(ddag, type, fast);
GDD_dag_delete(ddag);
return rs;
}
return -1;
}
int RS_estimate_saturating_values(GDD_DAG *ddag, const char *type, SCEDA_List **sat_values) {
*sat_values = RS_ddag_estimate_saturating_values(ddag, type);
return 0;
}
int RS_estimate_saturating_values_TC(SCEDA_Graph *ddg, const char *type, SCEDA_List **sat_values) {
GDD_DAG *ddag = GDD_dag_create(ddg);
if(ddag != NULL) {
int ret = RS_estimate_saturating_values(ddag, type, sat_values);
GDD_dag_delete(ddag);
return ret;
}
return -1;
}
int RS_compute_optimal_saturation(SCEDA_Graph *ddg, const char *type, double timeout, int *timeout_flag) {
int rs;
SCEDA_HashMap *k = NULL;
GDD_DAG *ddag = GDD_dag_create(ddg);
if(ddag == NULL) {
return -1;
}
*timeout_flag = !RS_ddag_compute_saturation(ddag, type, timeout, &rs, &k);
GDD_dag_delete(ddag);
if(*timeout_flag) {
if(k == NULL) {
rs = -1;
}
}
if(k != NULL) {
SCEDA_hashmap_delete(k);
}
return rs;
}