Commit c2695389 authored by danfis's avatar danfis

Fix for huge number of facts.

parent 09f8ffc1
......@@ -34,7 +34,7 @@ struct plan_strips;
* pairs.
*/
struct plan_mutex_pairs {
int *map; /*!< Dynamic 2-D map of facts */
char *map; /*!< 2-D map of facts */
int fact_size; /*!< Dimension of .map */
int num_mutex_pairs;
};
......
......@@ -70,14 +70,14 @@ static void h2Init(h2_t *h2,
bzero(h2, sizeof(*h2));
h2->fact_size = planStripsFactsSize(&strips->fact);
h2->op_size = planStripsOpsActiveSize(&strips->op);
h2->fact = BOR_CALLOC_ARR(char, h2->fact_size * h2->fact_size);
h2->fact = BOR_CALLOC_ARR(char, (size_t)h2->fact_size * h2->fact_size);
h2->op_applied = BOR_CALLOC_ARR(char, h2->op_size);
excess_mem = strips->excess_mem_limit;
excess_mem -= h2->fact_size * h2->fact_size;
excess_mem -= (size_t)h2->fact_size * h2->fact_size;
excess_mem -= h2->op_size;
op_fact_size = h2->fact_size * h2->op_size;
op_fact_size = (size_t)h2->fact_size * h2->op_size;
if (op_fact_size <= excess_mem){
h2->op_fact = BOR_CALLOC_ARR(char, op_fact_size);
PLAN_STRIPS_OPS_FOR_EACH(&strips->op, op){
......
......@@ -26,7 +26,7 @@ void planMutexPairsInit(plan_mutex_pairs_t *m, int fact_size)
{
bzero(m, sizeof(*m));
m->fact_size = fact_size;
m->map = BOR_CALLOC_ARR(int, fact_size * fact_size);
m->map = BOR_CALLOC_ARR(char, (size_t)fact_size * fact_size);
}
void planMutexPairsInitStrips(plan_mutex_pairs_t *m, const plan_strips_t *s)
......@@ -38,7 +38,8 @@ void planMutexPairsInitCopy(plan_mutex_pairs_t *dst,
const plan_mutex_pairs_t *src)
{
planMutexPairsInit(dst, src->fact_size);
memcpy(dst->map, src->map, sizeof(int) * src->fact_size * src->fact_size);
memcpy(dst->map, src->map,
sizeof(char) * (size_t)src->fact_size * src->fact_size);
dst->num_mutex_pairs = src->num_mutex_pairs;
}
......
Markdown is supported
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