如何撤消OpenAI Gym中的操作?

时间:2016-08-25 14:02:34

标签: python reinforcement-learning openai-gym

在OpenAI Gym中,我想了解同一州的不同行动的下一个州。例如,我想得到s_1,s_2,我的环境的动态是:

Thread 16 Crashed:
0   libobjc.A.dylib                      0x3b0f4b26 objc_msgSend + 6
1   CFNetwork                            0x308d9491 -[__NSCFLocalSessionTask setConnection:] + 718
2   CFNetwork                            0x30933c33 -[__NSCFLocalSessionBridge taskTerminating:] + 136
3   CFNetwork                            0x30932945 __64-[__NSCFLocalSessionBridge initWithConfiguration:session:queue:]_block_invoke + 46
4   CFNetwork                            0x30950b03 ___ZNK24ClassicConnectionSession28_connection_didFinishLoadingEP16_CFURLConnection_block_invoke + 96
5   libdispatch.dylib                    0x3b5dcd1b _dispatch_call_block_and_release + 8
6   libdispatch.dylib                    0x3b5e3273 _dispatch_queue_drain$VARIANT$mp + 372
7   libdispatch.dylib                    0x3b5e306b _dispatch_queue_invoke$VARIANT$mp + 40
8   libdispatch.dylib                    0x3b5e3ce1 _dispatch_root_queue_drain + 74
9   libdispatch.dylib                    0x3b5e3f59 _dispatch_worker_thread2 + 54
10  libsystem_pthread.dylib              0x3b71edbf _pthread_wqthread + 296
11  libsystem_pthread.dylib              0x3b71ec84 start_wqthread + 6

我找不到撤消操作的方法,或者在不改变环境的情况下向我显示下一个状态。有什么明显的东西我不见了吗?

如果有帮助,我这样做是为了区分LQR的动态和奖励,以及使用InvertedPendulum环境。

2 个答案:

答案 0 :(得分:1)

我找到了一个名为set_state的方法,它正是这样做的。它可以在以下位置找到: https://github.com/openai/gym/blob/12e8b763d5dcda4962cbd17887d545f0eec6808a/gym/envs/mujoco/mujoco_env.py#L86-L92

答案 1 :(得分:0)

尝试克隆环境。

private void UpoloadImageTofirebaseStorage() {
    user_id = mAuth.getCurrentUser().getUid();
    mStorageRef = FirebaseStorage.getInstance().getReference("users").child(user_id);
    if (imagePath != null) {
        //   final StorageReference imageRef = mStorageRef.child("users").child(user_id);
        UploadTask uploadTask = mStorageRef.putFile(imagePath);
        uploadTask.addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(@NonNull Exception e) {
                Log.i(TAG, "Store image in storage:failure", e);
            }
        });
        uploadTask.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
            @Override
            public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
                Task<Uri> downloadUrl = mStorageRef.getDownloadUrl();
                Log.i(TAG,"Image Added "+ downloadUrl);
                downloadUrl.addOnSuccessListener(new OnSuccessListener<Uri>() {
                    @Override
                    public void onSuccess(Uri uri) {
                        profileImageURL = uri.toString();
                        Log.i(TAG,"File Location"+  profileImageURL);
                        SaveUserToFirebaseDatabase( profileImageURL);

                    }
                });

            }
        });
    }
} 


  

// add user info to datadase
private void SaveUserToFirebaseDatabase(String profileImageURL)
        {
           user_id = mAuth.getCurrentUser().getUid();
            CreationDate = new  SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()).format(new Date());
            MyUsers user = new MyUsers(FullName,Password,EmailAddress,Gender, profileImageURL,CreationDate);
            //add user to profile & all
            DatabaseReference  mDatabase= FirebaseDatabase.getInstance().getReference("users/profile").child(user_id);
         
            mDatabase.setValue(user).addOnFailureListener(new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception e) {
                    Log.i(TAG," mDatabase unable to add data"+ e);
                }
            });
         
                   
            Toast.makeText( UserSignup.this, "your information Added Successfully ", Toast.LENGTH_LONG).show();
        }