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
input_string = "31495" | |
fav_strings = ["31", "314", "3149", "495"] | |
INF = len(input_string) | |
def substring_match(pos): | |
match_lengths = [] | |
for fav_string in fav_strings: | |
if len(fav_string) + pos <= len(input_string): | |
if fav_string in input_string[pos: pos + len(fav_string)]: |
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
import nibabel as nib | |
import pcl | |
import numpy as np | |
from pcl import IterativeClosestPoint | |
from pcl import pcl_visualization | |
# used for icp rigid alignemnt of fiducial candidate with synthetic fiducial for lits localization | |
def generate_synthetic_fiducial(): | |
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
'''this code implements annealed epsilon greedy ml agent for CartPole problem ''' | |
import numpy as np | |
import gym | |
class myAnnealedEpsilonGreedyCartPoleAgent(object): | |
def __init__(self, action_space): | |
self.action_space = action_space | |
assert (action_space, gym.spaces.discrete.Discrete), "unsupported action space for now." | |
def act(self, state, reward, time_step, done, default_epsilon = 0.98): | |
# TODO compute epsilon for current iteration |
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
# coding: utf-8 | |
import os | |
import logging | |
import tempfile | |
import numpy as np | |
import gym | |
#from gym.wrappers.monitoring import Monitor | |
class myEphsilonGreedyAgent(object): |
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
''' Gets list of furture rewards, associates discount factor with future rewards ''' | |
def discounted_future_return(rewards, gamma=0.98): | |
discounted_returns = [0 for _ in rewards] | |
discounted_returns[-1] = rewards[-1] | |
for t in range(len(rewards) - 2. -1, -1): | |
discounted_returns[t] = rewards[t] + gamma * discounted_returns[t+1] | |
return discounted_returns |
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
import os | |
import logging | |
import tempfile | |
import numpy as np | |
import gym | |
#from gym.wrappers.monitoring import Monitor | |
class RandomAgent(object): | |
def __init__ (self, action_space): |
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
/* | |
* Copyright (c) 2013 NVIDIA Corporation | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: | |
* |
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
void tetgenmesh::meshsurface() | |
{ | |
arraypool *ptlist, *conlist; | |
point *idx2verlist; | |
point tstart, tend, *pnewpt, *cons; | |
tetgenio::facet *f; | |
tetgenio::polygon *p; | |
int end1, end2; | |
int shmark, i, j; |
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
/*****************************************************************************/ | |
/* */ | |
/* Routines for Arbitrary Precision Floating-point Arithmetic */ | |
/* and Fast Robust Geometric Predicates */ | |
/* (predicates.c) */ | |
/* */ | |
/* May 18, 1996 */ | |
/* */ | |
/* Placed in the public domain by */ | |
/* Jonathan Richard Shewchuk */ |
This file has been truncated, but you can view the full file.
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
/////////////////////////////////////////////////////////////////////////////// | |
// // | |
// TetGen // | |
// // | |
// A Quality Tetrahedral Mesh Generator and A 3D Delaunay Triangulator // | |
// // | |
// Version 1.5 // | |
// May 31, 2014 // | |
// // | |
// Copyright (C) 2002--2014 // |
NewerOlder