Glen Berseth

I am an assistant professor at the University de Montreal and Mila. My research explores how to use deep learning and reinforcement learning to develop generalist robots.

misc Articles


  • Sat 21 November 2015
  • misc

Basic Reinforcement Learning Example using Logistic Regression

Glen Berseth

Reinforcement learning has been shown to solve complex problems. Recently it has been used with great success by google DeepMind playing Atari games. The success is great but understanding the basic of some of these frameworks/algorithms can be daunting. In this post I hope to eliminate some of the mental entropy caused by trying to understand how and why the algorithms work. I will focus on Logistic Regression as it is a simple and if we can understand this model then more complex models are far easier to comprehend.



  • Wed 21 October 2015
  • misc

Animation/Simulation System flow of control

Glen Berseth

Simulation for animation is no easy task. There are many steps when constructing an animation and figuring out when particular data should be instantiated can be tricky. I am going to go over one method I have been using to help organize the steps and structure that could be used to construct the simulation flow of control.



  • Fri 01 May 2015
  • misc

Knowledge vs Information

Glen Berseth

I have spent a far bit of time in the education system and I feel there is a great difference between knowledge and information. The internet is full of information, tons of small independent pieces of data. When you are at school you spend most of your time learning rules …


  • Wed 18 March 2015
  • misc

Install eclipse plugins via the command line

Glen Berseth

I am always a fan of making features usable on the command line. I use Ubuntu a bunch and one task I started was to write a script to install all of may favourite packages I like. One of the packages I love it Eclipse. It gives me the same …


  • Mon 09 March 2015
  • misc

Crowd Simulation Lecture

Glen Berserth

I recently gave a lecture on Crowd simulation. This lecture outlines some of the popular steering algorithms and then some of my work on making them even better via parameter optimization. You can find the presentation here.


  • Sun 21 December 2014
  • misc

High Resolution performance timer

Glen Berseth

I recently stumbled across this issue because I was trying to compile some code on an ARM based computer. There was code in the program I wanted to compile that uses assembly! I am not going to get into the details over which method might be faster or has higher resolution. From what I have learned this is the most compact and portable code to use if you want a high resolution counter that can be used for something like performance profiling.


  • Sun 12 October 2014
  • misc

Mesh Subdivision with the Loop Algorithm

Glen Berseth

Recently I have been learning more about polygonal meshes and operations you can perform on them. One of the first operations that can be done on a mesh, that is a kind of cool, is subdivision. The basic idea is that you have a mesh that is very course (few polygons, rough) and we want a method that can construct a smoother mesh from this course mesh. This has been a popular method for constructing extremely smooth meshes for movies for many years.




  • Tue 03 September 2013
  • misc

Generating Latex table of Matlab/Octave Matrix

Glen Berseth


I created some code in Octave/Matlab to generate latex table from matrix data. I created this because in my case I was tuning some data and algorithms for a paper I was writing and I loathed entering my data into the latex over and over in large tables.

The …


  • Sun 19 May 2013
  • misc

psycopg2 instering an array of polygons

Glen B

This post is an example of how to insert an array of polygons into the Postgres database using Python and psycopg2.

The most important and problematic part of inserting a polygon array is the string formatting for the polygon[].

The first thing I tried was to just make a string …



  • Sun 21 April 2013
  • misc

Install Twiki on Ubuntu 12.04

Glen B


This is short guide on how to install Twiki ~5.13 on Ubuntu 12.04. This guide has a fix or two that was not present in any other guide I found.

  1. Install all of the relevant dependencies.

    sudo apt-get install apache2 libgdal-perl libcgi-session-perl libhtml-tree-perl liberror-perl libfreezethaw-perl libgd2-xpm rcs libapache2-mod-perl2-doc …


  • Wed 17 April 2013
  • misc

Putting a steering algorithm into SteerSuite

Glen B



This is a guide I created which I hope to turn into a Wiki some day on how to put your steering algorithm in SteerSuite.

  1. First things first
    1. Your agent needs to extend the SteerLib::AgentInterface class so that is can be used properly with the gspacialDatabase
    2. If your algorithm …


  • Tue 19 March 2013
  • misc

Postgresql Transfer Database to New Tablespace with Python

Glen B

This is a quick script I wrote in python to generate the sql file needed to transfer one database to another tablespace.



 #!/usr/bin/python

# will generate the sql file needed to alter the tablespace for a database.

import psycopg2
import psycopg2.extras
import sys

#
# Configuration
#
host = '';            # The host on …


  • Sat 09 March 2013
  • misc

Rare but powerful Unix/Linux commands

Glen B

This blog is a list of some of the more powerful but not as frequently used Linux or Unix commands.

Need to copy a large amount of files from one directory to another

find \(directory1 -maxdepth 1 -type f -name '*' -exec mv {} $directory2/. \; </pre><pre class="programlisting"></pre><pre class …



  • Fri 08 March 2013
  • misc

Eclipse Find/Replace

Glen B

This is a quick example on how to use the power of find and replace in eclipse. Some might say that eclipse find and replace is not as powerful as something like vi or sed but it is still rather powerful.



I had a program where I wanted to transform …


  • Wed 06 March 2013
  • misc

'SmartBody Example:'

Glen B


SmartBody characters are usually controlled via python scripts. These scripts are responsible for loading all of the features need for the character animation and then seting up the character in the environment and last functions to control the actions of the character(s).

This is a common exmaple, there are …



  • Fri 22 February 2013
  • misc

IndiGolog Basics

Glen B

This is a guide on the steps I took set-up a IndiGolog Program.

I prefer to divide up the sections of an IndiGolog program into different files. The different sections of an IndiGolog program are:

  1. Exogenous Actions
    1. Contains the code to handle exogenous actions from then environment.
  2. Fluents
    1. Fluents handle …


  • Thu 21 February 2013
  • misc

Install/setup Postgres 9.1 on Ubuntu 12.04

Glen B

Start by installing Postgres:


sudo apt-get install postgresql


After installing the first thing that needs to be done is adjust the connections postgres will accept. open the file /etc/postgresql/9.1/main/posrgresql.conf and turn on the listen addres


listen_addresses = 'localhost'


Then turn password encryption on


password …


  • Wed 20 February 2013
  • misc

Python and TCP/IP

Glen B

TCP/IP in Python

Some notes on how TCP/IP works in Python (2.7).

Basic TCP client



import socket
import sys

# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# Connect the socket to the port where the server is listening
server_address = ('localhost' …


  • Wed 20 February 2013
  • misc

Get and Compile Smart Body

Glen B

This page is linked to another and will outline the steps to get and compile SmartBody.

Current svn command and link


svn co https://smartbody.svn.sourceforge.net/svnroot/smartbody/trunk smartbody 


To Compile for Windows follow the steps in the guide that basically just say to use visual studio …


  • Thu 07 February 2013
  • misc

Ubuntu 12.04 on ASUS n56v

Glen B

This blog is a collection of solutions to issues or not preferred settings in Ubuntu when installing on ASUS n56v

Press f2 to get into bios

  1. After installing Ubuntu fix Grub to boot Windows 8 again.
    1. So installing Ubuntu 12.04 along with a EFI partition with GRUB will result …