- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Generators/BFIG/unit-tests/testBFIGImplicant1.cpp

    00001
    00002 //
    00003 // Copyright (c) 2004           Model-based Embedded and Robotic Systems Group
    00004 // All Rights Reserved          Massachusetts Institute of Technology
    00005 //
    00006 // This software is provided as is. Model-based Embedded and Robotic Systems
    00007 // (MERS) group does not assume any responsibility.
    00008 //
    00010
    00011 #include "BFIGHelper.h"
    00012 #include <Mers/Generators/BFIG/BFIGImplicant.h>
    00013
    00014 #include <tut.h>
    00015
    00016 using Mers::Models::Base::BaseModelVariable;
    00017
    00018 namespace tut
    00019 {
    00024         class BFIGImplicant1Data : public BFIGHelper
    00025         {
    00026         public:
    00027
    00031                 BFIGImplicant1Data()
    00032                 {
    00034                         enum Domain {OnOffCommand = 0, OnOffValues = 1, SwitchMode = 2};
    00035
    00037                         const char * d1Vals[] = {"On", "Off", "No-Command", NULL};
    00038                         const char * d2Vals[] = {"On", "Off", NULL};
    00039                         const char * d3Vals[] = {"Broken", "Off", "On", NULL};
    00040
    00042                         const struct BFIGDomainEntry domains[] = {
    00043                                 {"On-Off-Command", d1Vals},
    00044                                 {"On-Off-Values", d2Vals},
    00045                                 {"Switch-Mode", d3Vals}
    00046                         };
    00047
    00049                         const double v1Probs[] = {0.02, 0.80, 0.99};
    00050                         const double v2Probs[] = {0.01, 0.70, 0.90};
    00051
    00052                         const BaseModelVariable::VariableType varType =
    00053                                 BaseModelVariable::State;
    00054
    00056                         const struct BFIGVariableEntry variables[] = {
    00057                                 // Search Variable, Variable Name, Domain Index,
    00058                                 // Variable Type, Probabilities, Costs
    00059                                 {true, {"Switch2.mode", SwitchMode, varType}, v1Probs},
    00060                                 {true, {"Switch1.mode", SwitchMode, varType}, v2Probs}
    00061                         };
    00062
    00063                         initBFIGData(sizeof(domains) / sizeof(domains[0]), domains,
    00064                                          sizeof(variables) / sizeof(variables[0]), variables);
    00065
    00066                         initBFIGVariables(true);
    00067                 }
    00068
    00072                 virtual ~BFIGImplicant1Data()
    00073                 {
    00074                 }
    00075         };
    00076
    00077
    00078   typedef test_group<BFIGImplicant1Data> BFIGImp1Factory;
    00079   typedef BFIGImp1Factory::object BFIGImp1Object;
    00080
    00082   BFIGImp1Factory bfigImp1Factory("BFIG Generator Test of BFIG Implicant #1");
    00083
    00087         template<>
    00088   template<>
    00089   void BFIGImp1Object::test<1>()
    00090   {
    00091
    00092         }
    00093
    00094
    00095 }
    00096
    00097