flock_true-termination.c

loading
details
attribute value
description
owner Akihisa Yamada
uploaded 2020-06-20 22:55:31.0
disk size 7.59 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 mod(TYPEOFVALUES n, TYPEOFVALUES m)
{
  //return (n >= 0) ? (n % m) : (m + (n % m));
  if (n >= 0) {
    return n - (n/m*m);
  }
  else {
    return m + (n-(n/m*m));
  }
}

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

TYPEOFVALUES Lvalue[3][2];
TYPEOFTIME Ltstamp[3][2];
const TYPEOFKEYLID tupleStart[2] = {0, 0};
const TYPEOFKEYLID tupleEnd[2] = {1, 1};
_Bool link(TYPEOFAGENTID __LABS_link1, TYPEOFAGENTID __LABS_link2, TYPEOFKEYLID key)
{
  _Bool __LABS_link = 0;
  if ((key >= 0) && (key <= 1))
  {
    __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);
  }

  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;
  Ltstamp[id][tupleStart[key]] = now();
  setHout(id, key);
}

popout

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

actions get anonymous link download benchmark