added adagrad, made trellis not use too many tuples so that it consumes less memory