I have a state S that needs to change to state S’ with a probability of Acceptance Pa. I’ve computed the probability of acceptance, and I have the two states (column vectors of 3 numbers each). I want to tell matlab to accept the change from S to S’ with probability Pa.
Note: this is going to be inside a loop, and for each iteration Pa is computed and S changes to S’ with probability Pa.
Help is appreciated
edit: here’s what I have so far. there is a matrix of all 35 possible states (Pool). S’ is Sn here.
S = [5;5;5];
indexn = randi(35);
Sn = Pool(:,indexn);
Cost is calculated here
PA = exp(-deltacost/k*T);
The next step would be to change S to Sn with probability PA. I might be overthinking this, but I don’t know how to change it.
This should do the trick