Class QSampler


  • public class QSampler
    extends java.lang.Object
    Interface for the sampling a configuration.
    • Constructor Summary

      Constructors 
      Constructor Description
      QSampler​(long cPtr, boolean cMemoryOwn)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void delete()  
      boolean empty()
      True if the sampler is known to contain no more
      configurations.
      static long getCPtr​(QSampler obj)  
      static QSamplerPtr makeConstrained​(QSamplerPtr sampler, QConstraintCPtr constraint)
      Map a sampler of standard configurations into a sampler of
      normalized configurations.

      A sampler of IK solutions for a specific target.

      static QSamplerPtr makeConstrained​(QSamplerPtr sampler, QConstraintCPtr constraint, int maxAttempts)
      Map a sampler of standard configurations into a sampler of
      normalized configurations.

      A sampler of IK solutions for a specific target.

      static QSamplerPtr makeEmpty()
      Empty sampler.
      static QSamplerPtr makeFinite​(QSamplerPtr sampler, int cnt)
      A sampler to that returns only the first cnt samples from
      another sampler.

      The sampler is considered empty as soon as sampler is empty or the
      sampler has been called cnt times or more.
      static QSamplerPtr makeFinite​(VectorQ qs)
      Sampler for the values of a finite sequence.

      sample() returns each of the values of qs in order.
      static QSamplerPtr makeFixed​(Q q)
      Sampler that always returns the same configuration.

      The sampler is considered never empty (empty() always returns false).
      static QSamplerPtr makeSingle​(Q q)
      Sampler that always returns a single configuration.

      The sample() returns q the first time the method is called and the
      empty configuration otherwise.
      static QSamplerPtr makeUniform​(Device device)
      Uniform random sampling for a box of the configuration space.

      Uniform random sampling for a device.
      static QSamplerPtr makeUniform​(DeviceCPtr device)
      Uniform random sampling for a device.
      Q sample()
      Sample a configuration.

      If sampling fails, the sampler may return the empty configuration.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • QSampler

        public QSampler​(long cPtr,
                        boolean cMemoryOwn)
    • Method Detail

      • getCPtr

        public static long getCPtr​(QSampler obj)
      • delete

        public void delete()
      • sample

        public Q sample()
        Sample a configuration.

        If sampling fails, the sampler may return the empty configuration. If
        empty() is true then the sampler has no more configurations.
        Otherwise sample() may (or may not) succeed if called a second time.
      • empty

        public boolean empty()
        True if the sampler is known to contain no more
        configurations.
      • makeEmpty

        public static QSamplerPtr makeEmpty()
        Empty sampler.
      • makeFixed

        public static QSamplerPtr makeFixed​(Q q)
        Sampler that always returns the same configuration.

        The sampler is considered never empty (empty() always returns false).
      • makeSingle

        public static QSamplerPtr makeSingle​(Q q)
        Sampler that always returns a single configuration.

        The sample() returns q the first time the method is called and the
        empty configuration otherwise. empty() returns true after the first
        call of sample().
      • makeFinite

        public static QSamplerPtr makeFinite​(VectorQ qs)
        Sampler for the values of a finite sequence.

        sample() returns each of the values of qs in order. When all of
        these samples have been returned, empty() returns true and sample()
        returns the empty configuration.
      • makeFinite

        public static QSamplerPtr makeFinite​(QSamplerPtr sampler,
                                             int cnt)
        A sampler to that returns only the first cnt samples from
        another sampler.

        The sampler is considered empty as soon as sampler is empty or the
        sampler has been called cnt times or more.
      • makeUniform

        public static QSamplerPtr makeUniform​(Device device)
        Uniform random sampling for a box of the configuration space.

        Uniform random sampling for a device.
      • makeUniform

        public static QSamplerPtr makeUniform​(DeviceCPtr device)
        Uniform random sampling for a device.
      • makeConstrained

        public static QSamplerPtr makeConstrained​(QSamplerPtr sampler,
                                                  QConstraintCPtr constraint,
                                                  int maxAttempts)
        Map a sampler of standard configurations into a sampler of
        normalized configurations.

        A sampler of IK solutions for a specific target.

        Parameters:
        sampler - [in] Sampler of IK solutions for target.


        A sampler filtered by a constraint.

        For each call of sample() up to maxAttempts configurations are
        extracted from sampler and checked by constraint. The first
        sample that satisfies the constraint is returned; if no such were
        found the empty configuration is returned.

        If maxAttempts is negative (this is the default), then sampler
        is sampled forever until either the sampler is empty or a
        configuration satisfying constraint is found.
      • makeConstrained

        public static QSamplerPtr makeConstrained​(QSamplerPtr sampler,
                                                  QConstraintCPtr constraint)
        Map a sampler of standard configurations into a sampler of
        normalized configurations.

        A sampler of IK solutions for a specific target.

        Parameters:
        sampler - [in] Sampler of IK solutions for target.


        A sampler filtered by a constraint.

        For each call of sample() up to maxAttempts configurations are
        extracted from sampler and checked by constraint. The first
        sample that satisfies the constraint is returned; if no such were
        found the empty configuration is returned.

        If maxAttempts is negative (this is the default), then sampler
        is sampled forever until either the sampler is empty or a
        configuration satisfying constraint is found.