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

Ok I see. Thanks!


On Thu, Jun 19, 2014 at 9:27 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]))
>
> self.copy_value(dest, cfgs[i])
>
> No need for get or set
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/jansel/opentuner/pull/36/files#r14003611>.
>