[][src]Crate flag_algebra

An implementation of flag algebras.

Example

extern crate flag_algebra;

use flag_algebra::*;
use crate::sdp::Problem;
use crate::flags::Graph;
use crate::operator::Basis;

pub fn main() {
    // Work on the graphs of size 3.
    let basis = Basis::new(3);

    // Define useful flags.
    let k3 = flag(&Graph::new(3, &[(0,1),(1,2),(2,0)])); // Triangle
    let e3 = flag(&Graph::new(3, &[])); // Independent set of size 3

    // Definition of the optimization problem.
    let pb = Problem::<i64, _> {
        // Constraints
        ineqs: vec!(total_sum_is_one(basis),
                    flags_are_nonnegative(basis)),
        // Use all relevant Cauchy-Schwarz inequalities.
        cs: basis.all_cs(),
        // Minimize density of triangle plus density of independent of size 3.
        obj: k3 + e3,
    };

    // Write the correspondind SDP program in "goodman.sdpa".
    // This program can then be solved by CSDP.
    pb.write_sdpa("goodman").unwrap();
}

Re-exports

pub use crate::operator::Basis;

Modules

combinatorics

Basic combinatorial functions.

common

Flat data structures for binary relations.

density

Computing coefficients of a flag algebra operator.

flags

Example of flags.

iterators

Streaming iterators on combinatorial objects (subsets, functions, ...).

operator

Computing and stocking operators of the flag algebra.

prettyprint

Print expression of computations in the flag algebra.

sdp

Create and manipulate semi-definite problems.

Structs

Ineq

A set of bounds on elements of a flag algebra.

IneqData

Contains the vector and the bound of one inequality in a flag algebra. This inequality has the form self.flag ≥ self.bound. Expression recording how the left sides where constructed.

IneqMeta

Contains informations about a set of inequalities of a flag algebra.

QFlag

An element of a flag algebra.

SubClass

A wrapper type for flags from a sub-class of flags.

Traits

Flag

Interface for object that can be used as flags.

SubFlag

Mechanism for defining a subclass of a flag class.

Functions

flag

Return the vector corresponding to the unlabeled flag f

flags_are_nonnegative

Return the inequalities expressing that the flags of basis are larger than zero.

total_sum_is_one

Return the inequalities expressing that the sum of the flags of basis is equal to one.