Modifier and Type | Field and Description |
---|---|
private static int[] |
curNum
store current number of car per type
|
private static int |
D
variables to that characterise the systems size
|
private static int[] |
initNum
store initial number of car per type
|
private static int |
l
length of the system, system size: l*l
|
private static int |
L
variables to that characterise the systems size
|
private static int |
LH
variables to that characterise the systems size
|
static int[] |
M
array to store the systems current configuration; values in {-1,0,1}
|
private static double[] |
movementarr
statistics of movement of the system
|
private static int |
movementcounter
current number of movements performed when system is updated
|
private static boolean |
movetest
variables to state whether system can move or is frozen/empty
|
private static boolean |
movetestvar |
private static double |
p
initial probability
|
private static boolean |
periodic
variable telling whether periodic boundary conditions apply
|
static int |
tend
maximal number of timesteps performed
|
private static int |
v1
velocity of first type of cars
|
private static int |
v2
velocity of second type of cars
|
private static int |
vmax
variables to that characterise the systems size
|
Constructor and Description |
---|
BihamLevine(int l,
double p,
int v1,
int v2,
boolean periodic,
int tend)
constructor of the class that sets the private variables to the given values
|
Modifier and Type | Method and Description |
---|---|
private static boolean |
checkM()
Checks whether number of cars stays the same
|
private static boolean |
freiefahrt(int k,
int t,
int v,
int recnum)
check whether the car at position k can move with velocity y
|
static int |
getD()
getter for another variable of the system
|
static int |
getL()
getter for system size
|
static int |
getlength()
getter for the system's length
|
static int[] |
getmatrix()
getter for the system's current state
|
static double[] |
getmove()
getter for the system's statistivcs of movement
|
static int |
getvmax()
getter for the system's maximum velocity
|
static void |
initM()
initializes the matrix M with a random configuration of values +/-1 else 0
and determines the initial number for later comparison
|
static boolean |
isPeriodic()
getter for periodic variable
|
private static int |
match(int t)
get the car type of the current time step
|
private static int |
nextstep(int k,
int t,
int v,
int direction)
computes the next step with velocity a in either backward or forward direction
|
static void |
printM()
Prints the matrix M to the stdout (console) in a fancy coloured way
|
static void |
setCarSpeed(int V1,
int V2)
setter for all variables that need to be changed
|
static void |
setL(int L)
setter for system size
|
static void |
setMovetest(boolean Movetest)
setter for system's runnability, neccessary for new run after reaching the time out
|
static void |
setP(double P)
setter for new agent density: initial density (periodic/ non periodic stopped), incoming density (non periodic running)
|
static void |
setPeriodic(boolean Periodic)
setter for periodic variable
|
static void |
setTend(int Tend)
setter for maximum run time (automatic time out)
|
static boolean |
stillRunning()
methode to check the systems ability to move in the next step
|
static void |
updateM(int t)
Updates the system on given time t
only one type of cars is updated, depending on time t
|
public static int[] M
private static int l
private static double p
private static int v1
private static int v2
private static boolean periodic
public static int tend
private static int[] initNum
private static int[] curNum
private static int movementcounter
private static double[] movementarr
private static boolean movetest
private static boolean movetestvar
private static int D
private static int L
private static int LH
private static int vmax
public BihamLevine(int l, double p, int v1, int v2, boolean periodic, int tend)
l
- size of the systemp
- probability for initial distribution of carsv1
- velocity of type 1 carsv2
- velocity of type 2 carsperiodic
- statement of periodic boundary condition for the simulationpublic static void initM()
public static void updateM(int t)
t
- current timestepprivate static boolean freiefahrt(int k, int t, int v, int recnum)
k
- position to be checkedt
- current time stepv
- velocity of the carrecnum
- counts the number of recursions to avoid infinite loopsprivate static int match(int t)
t
- current time stepprivate static int nextstep(int k, int t, int v, int direction)
k
- current positiont
- current time stepv
- velocity of the car at position vdirection
- direction of the next stepprivate static boolean checkM()
public static void printM()
public static boolean stillRunning()
public static double[] getmove()
public static int getlength()
public static int[] getmatrix()
public static int getvmax()
public static int getD()
public static void setCarSpeed(int V1, int V2)
V1
- new velocity of type 1V2
- new velocity of type 2public static boolean isPeriodic()
public static void setPeriodic(boolean Periodic)
Periodic
- of the systempublic static void setMovetest(boolean Movetest)
Movetest
- the movetest to setpublic static void setP(double P)
P
- probability/density of agents on the fieldpublic static int getL()
public static void setL(int L)
L
- the L to setpublic static void setTend(int Tend)
Tend
- the tend