-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
huanghuang
committed
Mar 23, 2012
1 parent
6c2436d
commit 35dd79d
Showing
2 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,42 @@ | |||
set encoding=utf8 | |||
set expandtab | |||
set textwidth=0 | |||
set tabstop=4 | |||
set softtabstop=4 | |||
set shiftwidth=4 | |||
set backspace=indent,eol,start | |||
set incsearch | |||
set ruler | |||
set wildmenu | |||
set commentstring=\ #\ %s | |||
set foldlevel=0 | |||
set clipboard+=unnamed | |||
set tags=/home/huanghuang/shire/tags | |||
syntax on | |||
set list listchars=tab:▷⋅,trail:⋅,nbsp:⋅ | |||
set statusline=%F%m%r%h%w\ [TYPE=%Y\ %{&ff}]\ | |||
\ [%l/%L\ (%p%%) | |||
filetype plugin indent on | |||
au FileType py set autoindent | |||
au FileType py set smartindent | |||
au FileType py set textwidth=79 " PEP-8 Friendly | |||
" NERD_tree config | |||
let NERDTreeChDirMode=2 | |||
let NERDTreeIgnore=['\.vim$', '\~$', '\.pyc$', '\.swp$'] | |||
let NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\~$'] | |||
let NERDTreeShowBookmarks=1 | |||
map <F3> :NERDTreeToggle<CR> | |||
" Viewport Controls | |||
" ie moving between split panes | |||
map <silent>,h <C-w>h | |||
map <silent>,j <C-w>j | |||
map <silent>,k <C-w>k | |||
map <silent>,l <C-w>l | |||
let g:pydiction_location = '/home/huanghuang/.vim/pydiction-1.2/complete-dict' | |||
"autocmd FileType python compiler pylint | |||
"let g:pylint_onwrite = 0 | |||
au BufRead,BufNewFile *.c,*.cpp,*.py 2match Underlined /.\%81v/ | |||
if has("gui_running") | |||
highlight SpellBad term=underline gui=undercurl guisp=Orange | |||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,84 @@ | |||
# -------------- | |||
# USER INSTRUCTIONS | |||
# | |||
# Write a function called stochastic_value that | |||
# takes no input and RETURNS two grids. The | |||
# first grid, value, should contain the computed | |||
# value of each cell as shown in the video. The | |||
# second grid, policy, should contain the optimum | |||
# policy for each cell. | |||
# | |||
# Stay tuned for a homework help video! This should | |||
# be available by Thursday and will be visible | |||
# in the course content tab. | |||
# | |||
# Good luck! Keep learning! | |||
# | |||
# -------------- | |||
# GRADING NOTES | |||
# | |||
# We will be calling your stochastic_value function | |||
# with several different grids and different values | |||
# of success_prob, collision_cost, and cost_step. | |||
# In order to be marked correct, your function must | |||
# RETURN (it does not have to print) two grids, | |||
# value and policy. | |||
# | |||
# When grading your value grid, we will compare the | |||
# value of each cell with the true value according | |||
# to this model. If your answer for each cell | |||
# is sufficiently close to the correct answer | |||
# (within 0.001), you will be marked as correct. | |||
# | |||
# NOTE: Please do not modify the values of grid, | |||
# success_prob, collision_cost, or cost_step inside | |||
# your function. Doing so could result in your | |||
# submission being inappropriately marked as incorrect. | |||
|
|||
# ------------- | |||
# GLOBAL VARIABLES | |||
# | |||
# You may modify these variables for testing | |||
# purposes, but you should only modify them here. | |||
# Do NOT modify them inside your stochastic_value | |||
# function. | |||
|
|||
grid = [[0, 0, 0, 0], | |||
[0, 0, 0, 0], | |||
[0, 0, 0, 0], | |||
[0, 1, 1, 0]] | |||
|
|||
goal = [0, len(grid[0])-1] # Goal is in top right corner | |||
|
|||
|
|||
delta = [[-1, 0 ], # go up | |||
[ 0, -1], # go left | |||
[ 1, 0 ], # go down | |||
[ 0, 1 ]] # go right | |||
|
|||
delta_name = ['^', '<', 'v', '>'] # Use these when creating your policy grid. | |||
|
|||
success_prob = 0.5 | |||
failure_prob = (1.0 - success_prob)/2.0 # Probability(stepping left) = prob(stepping right) = failure_prob | |||
collision_cost = 100 | |||
cost_step = 1 | |||
|
|||
|
|||
############## INSERT/MODIFY YOUR CODE BELOW ################## | |||
# | |||
# You may modify the code below if you want, but remember that | |||
# your function must... | |||
# | |||
# 1) ...be called stochastic_value(). | |||
# 2) ...NOT take any arguments. | |||
# 3) ...return two grids: FIRST value and THEN policy. | |||
|
|||
def stochastic_value(): | |||
value = [[1000 for row in range(len(grid[0]))] for col in range(len(grid))] | |||
policy = [[' ' for row in range(len(grid[0]))] for col in range(len(grid))] | |||
|
|||
return value, policy | |||
|
|||
|
|||
|
|||
|