Miscellaneous programs and code snippets



Prolog implementations of bubble sort, quicksort and merge sort: sorting.pl

A few comparisons are included.




Method of steepest ascent for solving quadratic programming problems with linear constraints of arbitrary dimension, implemented in Prolog: ascent.pl

SWI-Prolog's simplex library is used to determine the locally best direction. The central predicate is maximize/5; its arguments are:
  1. in: objective function
  2. in: matrix A, as a list of rows
  3. in: b, the right-hand side of the linear constraints
  4. in: starting position
  5. out: computed optimum

Example:
        maximize(- ((x(1) - 2)^2) - (x(2) - 4)^2,
                   [[1,1],[1,-1],[1,0],[-1,0]],
                   [4,0,1,0],
                   [0,0], Max).

        Max = [1, 3] ;
    



Emacs definitions

htmlify.el: M-x htmlify on a region replaces "ä" by "ä", "ß" by "ß" etc.




Repgor, a report generator.




Main page