possible fix for IntegerParameter.sv_swarm and changing default behavior for sv_swarm

Ok. What about get_value though?


On Thu, Jun 19, 2014 at 9:21 PM, Jason Ansel <notifications@github.com>
wrote:

> In opentuner/search/manipulator.py:
>
> > -  def sv_swarm(self, position, global_best, local_best, *args, **kwargs):
> > -    log.debug('%s is not updated', self.__class__)
> > +  def sv_mix(self, dest, cfgs, ratio,  *args, **kwargs):
> > +    """
> > +    Stochastically recombine values from multiple parent configurations and save the
> > +    resulting value in dest.
> > +    cfgs: list of configuration data (dict)
> > +    ratio: list of floats
> > +    """
> > +    assert len(cfgs)==len(ratio)
> > +    r = random.random()
> > +    print r
> > +    c = numpy.array(ratio, dtype=float)/sum(ratio)
> > +    for i in range(len(c)):
> > +      if r < sum(c[:i+1]):
> > +        self.set_value(dest, self.get_value(cfgs[i]))
>
> Perhaps call copy_value instead -- which is in both classes? (And leave
> it in the base class.)
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/jansel/opentuner/pull/36/files#r14003491>.
>