boids_true-termination.c

loading
details
attribute value
description
owner Akihisa Yamada
uploaded 2020-06-20 22:55:31.0
disk size 10.29 KB
downloadable true
type
attribute value
name no_type
processor id 1
description this is the default benchmark type for rejected benchmarks and benchmarks that are not associated with a type.
owning community none
loading contents
/*
 * Program used in the experimental evaluation of the following paper:
 * De Nicola, Di Stefano, Inverso. Multi-Agent Systems With Virtual Stigmergies. Sci.Comp. Progr. 187, 2020
 *
 * Date: 2020
 * Authors: Luca Di Stefano, Omar Inverso
 * Contact: luca <dot> distefano <at> gssi <dot> it
 */
extern int __VERIFIER_nondet_int(void);
typedef char TYPEOFVALUES;
typedef unsigned char TYPEOFPC;
typedef unsigned char TYPEOFTIME;
typedef unsigned char TYPEOFAGENTID;
typedef unsigned char TYPEOFKEYIID;
typedef unsigned char TYPEOFKEYLID;
TYPEOFVALUES __abs(TYPEOFVALUES x)
{
  return (x > 0) ? (x) : (-x);
}

TYPEOFVALUES mod(TYPEOFVALUES n, TYPEOFVALUES m)
{
  return (n >= 0) ? (n % m) : (m + (n % m));
}

TYPEOFVALUES I[3][2];
TYPEOFPC pc[3][1];
TYPEOFTIME __LABS_time;
_Bool Hin[3][6];
_Bool Hout[3][6];
unsigned char HinCnt[3];
unsigned char HoutCnt[3];
TYPEOFTIME now(void)
{
  return ++__LABS_time;
}

TYPEOFVALUES Lvalue[3][6];
TYPEOFTIME Ltstamp[3][6];
const TYPEOFKEYLID tupleStart[6] = {0, 0, 0, 0, 4, 4};
const TYPEOFKEYLID tupleEnd[6] = {3, 3, 3, 3, 5, 5};
_Bool link(TYPEOFAGENTID __LABS_link1, TYPEOFAGENTID __LABS_link2, TYPEOFKEYLID key)
{
  _Bool __LABS_link = 0;
  if ((key >= 4) && (key <= 5))
  {
    __LABS_link = (((I[__LABS_link1][0] - I[__LABS_link2][0]) * (I[__LABS_link1][0] - I[__LABS_link2][0])) + ((I[__LABS_link1][1] - I[__LABS_link2][1]) * (I[__LABS_link1][1] - I[__LABS_link2][1]))) <= (5 * 5);
  }
  else
    if ((key >= 0) && (key <= 3))
  {
    __LABS_link = Lvalue[__LABS_link1][0] >= Lvalue[__LABS_link2][0];
  }


  return __LABS_link;
}

TYPEOFTIME timeof(TYPEOFAGENTID id, TYPEOFKEYLID key)
{
  return Ltstamp[id][tupleStart[key]];
}

void setHin(TYPEOFAGENTID id, TYPEOFKEYLID key)
{
  HinCnt[id] = HinCnt[id] + (!Hin[id][tupleStart[key]]);
  Hin[id][tupleStart[key]] = 1;
}

void clearHin(TYPEOFAGENTID id, TYPEOFKEYLID key)
{
  HinCnt[id] = HinCnt[id] - Hin[id][tupleStart[key]];
  Hin[id][tupleStart[key]] = 0;
}

void setHout(TYPEOFAGENTID id, TYPEOFKEYLID key)
{
  HoutCnt[id] = HoutCnt[id] + (!Hout[id][tupleStart[key]]);
  Hout[id][tupleStart[key]] = 1;
}

void clearHout(TYPEOFAGENTID id, TYPEOFKEYLID key)
{
  HoutCnt[id] = HoutCnt[id] - Hout[id][tupleStart[key]];
  Hout[id][tupleStart[key]] = 0;
}

void attr(TYPEOFAGENTID id, TYPEOFKEYIID key, TYPEOFVALUES value, _Bool check)
{
  __VERIFIER_assume((!check) || (HoutCnt[id] == 0));
  __VERIFIER_assume((!check) || (HinCnt[id] == 0));
  I[id][key] = value;
  now();
}

void lstig(TYPEOFAGENTID id, TYPEOFKEYLID key, TYPEOFVALUES value, _Bool check)
{
  __VERIFIER_assume((!check) || (HoutCnt[id] == 0));
  __VERIFIER_assume((!check) || (HinCnt[id] == 0));
  Lvalue[id][key] = value;
popout

content may be truncated. 'popout' for larger text window.

actions get anonymous link download benchmark