Fleet  0.0.9
Inference in the LOT
Classes | Typedefs | Enumerations | Variables
Main.cpp File Reference
#include "EigenLib.h"
#include "TopN.h"
#include <string>
#include "Grammar.h"
#include "Singleton.h"
#include "LOTHypothesis.h"
#include "FullMCTSNode.h"
#include "PartialMCTSNode.h"
#include "MinimalMCTSNode.h"
#include "MCMCChain.h"
#include "ParallelTempering.h"
#include "EnumerationInference.h"
#include "PriorInference.h"
#include "BeamSearch.h"
#include "ChainPool.h"
#include "PartitionMCMC.h"
#include "FullLZEnumeration.h"
#include "PartialLZEnumeration.h"
#include "BasicEnumeration.h"
#include "HillClimbing.h"
#include "Fleet.h"
Include dependency graph for Main.cpp:

Classes

class  MyHypothesis
 

Typedefs

using S = std::string
 

Enumerations

enum  ProposalType { ProposalType::RationalRules, ProposalType::InsertDelete, ProposalType::Prior }
 

Variables

const bool show_data = false
 
S alphabet = "0123456789"
 
thread_local S datastr = "734:347,1987:1789,113322:112233,679:679,214:124,9142385670:0123456789"
 
S testinput = "12345"
 
const float strgamma = 0.0001
 
const int MAX_LENGTH = 64
 
size_t MAX_GRAMMAR_DEPTH = 256
 

Typedef Documentation

◆ S

using S = std::string

Enumeration Type Documentation

◆ ProposalType

enum ProposalType
strong
Declare a grammar
This requires a template to specify what types they are (and what order they are stored in)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
public:
add("tail(%s)", +[](S s) -> S { return (s.empty() ? S("") : s.substr(1,S::npos)); });
add("head(%s)", +[](S s) -> char { return (s.empty() ? ' ' : s[0]); }, 5);
add("pair(%s,%s)", +[](S a, char b) -> S {
if(a.length() + 1> MAX_LENGTH)
throw VMSRuntimeError();
return a+b;
});
add("\u00D8", +[]() -> S { return S(""); });
add("eq_s(%s,%s)", +[](S x, S y) -> bool { return x==y; }, 1./2.);
add("eq_c(%s,%s)", +[](char x, char y) -> bool { return x==y; }, 1./2.);
add("and(%s,%s)", +[](bool a, bool b) -> bool { return (a and b); }, 1./3.);
add("or(%s,%s)", +[](bool a, bool b) -> bool { return (a or b); }, 1./3.);
add("not(%s)", +[](bool a) -> bool { return (not a); }, 1./3.);
add("(%s<%s)", +[](S x, S y) -> bool { return x < y; }, 1./2);
add("(%s<%s)", +[](char x, char y) -> bool { return x < y; }, 1./2);
add("incr(%s)", +[](char x) -> char { return x+1;});
add("decr(%s)", +[](char x) -> char { return x-1;});
// Pretty easy to learn with reverse
add("reverse(%s)", +[](S x) -> S { return reverse(x); }, 1.);
// repetitions
add("repeat(%s,%s)", +[](S x, int n) -> S {
S w = "";
if(x.size() * n > MAX_LENGTH or n < 0 or n > MAX_LENGTH)
throw VMSRuntimeError(); // need n > MAX_LENGTH in case n is huge but string is empty
for(int i=0;i<n;i++) {
w = w+x;
}
return w;
}, 1.);
add("int(%s)", +[](char c) -> int {
return int(c-'0'); // int here starting at '0'
});
add("x", Builtins::X<MyGrammar>, 10);
add("if_s(%s,%s,%s)", Builtins::If<MyGrammar,S>, 1./3);
add("if_c(%s,%s,%s)", Builtins::If<MyGrammar,char>, 1./3);
add("if_i(%s,%s,%s)", Builtins::If<MyGrammar,int>, 1./3);
add("recurse(%s)", Builtins::Recurse<MyGrammar>);
}
/*

Declare our hypothesis type ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Enumerator
RationalRules 
InsertDelete 
Prior 

Variable Documentation

◆ alphabet

S alphabet = "0123456789"

◆ datastr

thread_local S datastr = "734:347,1987:1789,113322:112233,679:679,214:124,9142385670:0123456789"

◆ MAX_GRAMMAR_DEPTH

size_t MAX_GRAMMAR_DEPTH = 256

◆ MAX_LENGTH

const int MAX_LENGTH = 64

◆ show_data

const bool show_data = false

◆ strgamma

const float strgamma = 0.0001

◆ testinput

S testinput = "12345"