A method and system are disclosed for improving a policy for a stochastic control problem, the stochastic control problem being characterized by a set of actions, a set of states, a reward structure as a function of states and actions, and a plurality of decision epochs, the method comprising using a sampling device obtaining data representative of sample configurations of a Boltzmann machine, obtaining initialization data and an initial policy for the stochastic control problem; assigning data representative of an initial weight and a bias of respectively each coupler and each node and the transverse field strength of the Boltzmann machine to the sampling device; until a stopping criterion is met generating a present-epoch state-action pair, amending data representative of none or at least one coupler and at least one bias, performing a sampling corresponding to the present-epoch state-action pair to obtain first sampling empirical means, obtaining an approximation of a value of a Q-function at the present-epoch state-action, obtaining a future-epoch state-action pair, wherein the state is obtained through a stochastic state process, and further wherein the obtaining of the action comprises performing a stochastic optimization test on the plurality of all state-action pairs comprising the future-epoch state and any possible action to thereby provide the action at the future-epoch and update the policy for the future-epoch state; amending data representative of none or at least one coupler and at least one bias, performing a sampling corresponding to the future-epoch state-action pair, obtaining an approximation of a value of the Q-function at the future-epoch state-action, updating each weight and each bias and providing the policy when the stopping criterion is met.