Here's an applicative problem I'm trying to solve. Imagine there is a road that can be classified in 5 states. Can be something from good to bad etc. There are 4 maintenance actions possible. And the idea is to find a minimum cost policy for steady state. Which means if the road was 60% in state B and 40% in state C, and I were to apply action 1 on B and action 2 on C, they could swap but next year again, the distribution will be 60% and 40%.
s = 5 #states a = 4 #actions costs = [0, 25, 50, 100] #cost of actions tpm_1 = np.array([ [0.9, 0.1, 0, 0, 0], [0, 0.8, 0.2, 0, 0], [0, 0, 0.6, 0.4, 0], [0, 0, 0, 0.7, 0.3], [0, 0, 0, 0, 1] ]) #transition probabilities for action 1: do nothing, meaning if nothing is done and the asset is in state 1, there's 90% chance that it stays there and 10% chance it goes to state B. w = steady.continuous_var_matrix(s, a, lb=0, ub=1, name='a')
I next created these action variables, representing probabilities or fractions of roads in different categories on which different actions are to be taken. To apply steady state condition, I need to apply the constraint,
Current state*transition probabilities = current state.
continuous_var_matrix() function creates a dictionary and not a matrix of variables. How do I go about then applying matrix multiplication on this?
Why would you name something matrix, make a dict and not give it any functions of matrix?