public double searchNewton()
    {
        double cost, newcost;
        if (contc<2)
        {
            graspCost=1e10;
            return graspCost;
        }
        for (int i=0;i<contc;i++)
            clist[i].ftor=1+Math.random();
        newton();
        cost=costNewton();

        int k=0;
        while (k<newton_MAX_IT && cost>newton_zero)
        {
            int g=(int)(Math.random()*contc);
            double pert=(0.1+Math.random())*pert_rate;
            if (Math.random() < 0.5)
                pert=-pert;
            if (clist[g].ftor+pert > MIN_FTOR)
                clist[g].ftor+=pert;
            else
                continue;
            newton();
            newcost=costNewton();
            if (newcost > cost)
            {
                clist[g].ftor -= pert*(1+Math.random()*0.5);
                if (clist[g].ftor < MIN_FTOR)
                    clist[g].ftor=MIN_FTOR;
                newton();
                cost=costNewton();
            }
            else
            {
                cost=newcost;
            }
            //if (k%50==0) {
            //	System.out.println(k+") cost: "+cost);//+" [ "+str());
            //}
            k++;
        }
        graspCost=cost;
        return cost;
    }