#  Copyright (c) 1997-2009
#  Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Darmstadt, Germany)
#  http://www.polymake.de
#
#  This program is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by the
#  Free Software Foundation; either version 2, or (at your option) any
#  later version: http://www.gnu.org/licenses/gpl.txt.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#-------------------------------------------------------------------------------
#  $Project: polymake $$Id: morse_matching.rules 9574 2010-03-16 17:17:03Z herr $

INCLUDE
   complex_properties.rules

object SimplicialComplex {

# @category Topology
# to compute a Morse matching by the greedy algorithm
label greedy

# @category Topology
# to compute a Morse matching by Forman's canceling algorithm
label cancel


# @category Topology
# A Morse matching is a reorientation of the arcs in the Hasse diagram of a simplicial complex
# such that at most one arc incident to each face is reoriented (matching condition) and the
# resulting orientation is acyclic (acyclicity condition). Morse matchings capture the main
# structure of discrete Morse functions, see
#
#	Robin Forman: Morse Theory for Cell-Complexes,
#	Advances in Math., 134 (1998), pp. 90-145.
#
# This property is computed by one of two heuristics. The default heuristic is
# a simple greedy algorithm ([[greedy]]). The alternative is to use a canceling algorithm
# due to Forman ([[cancel]]). Note that the computation of a Morse matching of largest
# size is NP-hard. See
#
#	Michael Joswig, Marc E. Pfetsch: Computing Optimal Morse Matchings
#	SIAM J. Discrete Math., 2006, to appear
#
property MORSE_MATCHING : Graph;

# @category Topology
# Size of the computed Morse matching.
# FIXME: temporary
property MORSE_MATCHING_SIZE : Int;


#rule MORSE_MATCHING_SIZE : MORSE_MATCHING {
#  client("morse_matching_size", $this);
#}


# @category Topology
# The critical faces of the computed Morse matching, i.e., the faces not
# incident to any reoriented arc (not matched).
# FIXME: temporary
property MORSE_MATCHING_CRITICAL_FACES : Array<Set>;


# @category Topology
# The vector of critical faces in each dimension.
# FIXME: temporary
property MORSE_MATCHING_CRITICAL_FACE_VECTOR : Array<Int>;


#rule MORSE_MATCHING_CRITICAL_FACES, MORSE_MATCHING_CRITICAL_FACE_VECTOR : MORSE_MATCHING {
#  client("morse_matching_critical_faces", $this);
#}

# @category Topology
# Number of critical faces of the computed Morse matching.
# FIXME: temporary
property MORSE_MATCHING_N_CRITICAL_FACES : Int;


#rule MORSE_MATCHING_N_CRITICAL_FACES: MORSE_MATCHING {
#  client("morse_matching_n_critical_faces", $this);
#}


# clients to compute Morse matching:
#rule MORSE_MATCHING, MORSE_MATCHING_SIZE, MORSE_MATCHING_CRITICAL_FACES, MORSE_MATCHING_N_CRITICAL_FACES, MORSE_MATCHING_CRITICAL_FACE_VECTOR : HASSE_DIAGRAM {
#  client("morse_matching", $this, "-both");
#}
#weight 2.10;

#rule greedy.morse_matching: MORSE_MATCHING, MORSE_MATCHING_SIZE, MORSE_MATCHING_CRITICAL_FACES, MORSE_MATCHING_N_CRITICAL_FACES, MORSE_MATCHING_CRITICAL_FACE_VECTOR : HASSE_DIAGRAM {
#  client("morse_matching", $this, "-greedy");
#}
#weight 1.10;

#rule cancel.morse_matching: MORSE_MATCHING, MORSE_MATCHING_SIZE, MORSE_MATCHING_CRITICAL_FACES, MORSE_MATCHING_N_CRITICAL_FACES, MORSE_MATCHING_CRITICAL_FACE_VECTOR : HASSE_DIAGRAM {
#  client("morse_matching", $this, "-cancel");
#}
#weight 2.10;

}


# Local Variables:
# mode: perl
# c-basic-offset:3
# End:
