Giter VIP home page Giter VIP logo

inverse_rl's Issues

a problem about coefficient

line 178 in the file"inverse_rl/Paper1_Implementation/lp_discrete_gridworld/LinearProgrammingGridWorldSmallStates.py " :
c[25:2 * 25] = -1
it is coefficient (P_a1-P_a)(I-gamma*P_a1)^{-1},and why is it -1?in the line 173:
condition= - np.dot(trans_probs[i, :, optimalAction] - trans_probs[i, :, j], tempInverse),,its coefficient have been set "-1"?
thanks very much!

I cannot understand the linear programming part in the code

Can the auther give more explanation about the part of linear programming. The code is shown as below:
`
def performInverseReinforcementLearning( policy, gamma=0.5, l1=10):
trans_probs=constructTransitionMatrix()
conditions=[]
c = np.zeros([3 * 25])

for i in range(25):
    optimalAction = policy[i]
    tempTransProbMatrix= gamma * trans_probs[:, :, optimalAction]
    test = np.identity(25)-tempTransProbMatrix
    tempInverse = np.linalg.inv(np.identity(25) - tempTransProbMatrix)
    print(tempInverse.shape)
    
    for j in range(4):
        if(j != optimalAction):
            test_c = trans_probs[i, :, optimalAction]
            print(test_c.shape)

            condition= - np.dot(trans_probs[i, :, optimalAction] - trans_probs[i, :, j], tempInverse)
            print(condition.shape)
            conditions.append(condition)
print(len(conditions), len(condition[0]))
equality=np.zeros(625)
for i in range(25):
    c[25:2 * 25] = -1
    c[2 * 25:] = l1
print(c.shape)
print(c)
conditions=np.array(conditions)
print(conditions)
conditions=np.reshape(conditions,[625,75])
print(conditions)
print(len(c),conditions.shape)
rewards=linprog(c, A_ub=conditions, b_ub=equality)

#rewards = rewards/max(rewards)
return rewards`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.