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

If I intend to have this for ComplexParameter as well, should I copy the
code over?

Or should I use _get directly?


On Thu, Jun 19, 2014 at 9:15 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]))
>
> This needs to go in PrimitiveParameter. Parameter doesn't have set_value
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/jansel/opentuner/pull/36/files#r14003306>.
>