Class Posterior

    • Field Detail

      • goal

        protected org.apache.commons.math3.optim.nonlinear.scalar.GoalType goal
      • x0

        protected int x0
      • x0state

        protected int x0state
      • sequence

        protected int[] sequence
    • Constructor Detail

      • Posterior

        public Posterior​(GraphicalModel<? extends GenericFactor> model,
                         org.apache.commons.math3.optim.nonlinear.scalar.GoalType dir,
                         int x0,
                         int x0state,
                         gnu.trove.map.TIntIntMap evidence)
    • Method Detail

      • eval

        public double eval​(Solution from,
                           Move doing)
        Evaluate the value for a move and get the new vertex

        doing - if null from will be evaluated
        Returns:
      • eval

        public double eval​(Solution solution)
        Description copied from interface: ObjectiveFunction
        This might and should be mapped to eval(solution, null); Evaluation of a solution should really be cached. This method might be called multiple times for a solution
        Returns:
      • getGoal

        public org.apache.commons.math3.optim.nonlinear.scalar.GoalType getGoal()
      • getX0factor

        protected BayesianFactor getX0factor()
        This is a custom bayesian factor over x0 with a 1 for x0state. The value is cached.
        Returns:
      • fixNotMoving

        protected void fixNotMoving​(Solution from,
                                    Move move)
        Make non vertex changing moves illegal.
        Parameters:
        from -
        move -
      • calcPosterior

        protected BayesianFactor calcPosterior​(Solution sol,
                                               int[] query,
                                               gnu.trove.map.TIntIntMap ev)
      • isImprovement

        public boolean isImprovement​(double change)
        Description copied from interface: ObjectiveFunction
        since we did not specify if a positive change is good or bad here we can get that information
        Specified by:
        isImprovement in interface ObjectiveFunction<Move,​Solution>
        Returns:
      • isImprovement

        public boolean isImprovement​(double from,
                                     double to)
        Description copied from interface: ObjectiveFunction
        since we did not specify if a positive change is good or bad here we can get that information. If any of the inputs is NaN the other must be an improvement. If both are NaN it should not be an improvement.
        Specified by:
        isImprovement in interface ObjectiveFunction<Move,​Solution>
        Returns:
      • isBound

        public boolean isBound​(double value)
        Description copied from interface: ObjectiveFunction
        Test whether the provided score is a bound. This will be used to test if we reached a known upper/lower bound and should not continue.
        Specified by:
        isBound in interface ObjectiveFunction<Move,​Solution>
        Parameters:
        value - a score
        Returns:
        true if the score is a bound in the optimizing direction