OKlibrary  0.2.1.6
Domains.mac
Go to the documentation of this file.
```00001 /* Oliver Kullmann, 1.12.2007 (Swansea) */
00002 /* Copyright 2007, 2008, 2009, 2010 Oliver Kullmann
00003 This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
00004 it and/or modify it under the terms of the GNU General Public License as published by
00005 the Free Software Foundation and included in this library; either version 3 of the
00006 License, or any later version. */
00007
00022 oklib_include("OKlib/ComputerAlgebra/DataStructures/Lisp/Lists.mac")\$
00023
00024
00025 /*
00026  A "domain association" is a non-empty list D of sets, where the variables are
00027  {1, ..., |D|}, and D[i] is the domain of variable i.
00028 */
00029
00030 /* ********************
00031    * Helper functions *
00032    ********************
00033 */
00034
00035 /* For a domain association returns the list of domain sizes: */
00036 dom_lengths(dom) := map(length,dom)\$
00037
00038 /* For a domain association returns the list of logs of domain sizes.
00039    Prerequisite: No empty domains. */
00040 log_dom_lengths(dom) := float(map(log,dom_lengths(dom)))\$
00041
00042
00043 /* ***************************
00044    * Heuristical evaluations *
00045    ***************************
00046 */
00047
00048 /* For a domain association returns the minimal domain size: */
00049 min_dom_size(dom) := lmin(dom_lengths(dom))\$
00050
00051 /* For a domain association returns the maximal domain size: */
00052 max_dom_size(dom) := lmax(dom_lengths(dom))\$
00053
00054 /* For a domain association returns the sum of logarithms of domain sizes
00055    (all domains must be non-empty): */
00056 sum_log_dom_size(dom) := sum_l(log_dom_lengths(dom))\$
00057 /* The underlying "precise" value (equal, and numerically more precise, but
00058    numerically computable only for small domains):
00059 */
00060 log_prod_dom_size(dom) := log(prod_l(dom_lengths(dom)))\$
00061
```