From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24386 invoked by alias); 23 Jan 2012 19:49:05 -0000 Received: (qmail 24370 invoked by uid 22791); 23 Jan 2012 19:49:04 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-yw0-f41.google.com (HELO mail-yw0-f41.google.com) (209.85.213.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 Jan 2012 19:48:46 +0000 Received: by yhpp34 with SMTP id p34so1560697yhp.0 for ; Mon, 23 Jan 2012 11:48:46 -0800 (PST) MIME-Version: 1.0 Received: by 10.236.189.105 with SMTP id b69mr13830734yhn.90.1327348126074; Mon, 23 Jan 2012 11:48:46 -0800 (PST) Received: by 10.236.80.10 with HTTP; Mon, 23 Jan 2012 11:48:46 -0800 (PST) In-Reply-To: References: Date: Mon, 23 Jan 2012 19:49:00 -0000 Message-ID: Subject: Fwd: GSL mnultimin From: "Jonathan \"Duke\" Leto" To: gsl-discuss@sourceware.org Cc: "Filipe G. Vieira" , Thierry Moisan Content-Type: text/plain; charset=ISO-8859-1 Mailing-List: contact gsl-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gsl-discuss-owner@sourceware.org X-SW-Source: 2012-q1/txt/msg00001.txt.bz2 Howdy, Passing along this question about Math::GSL here, since this list is more appropriate. Duke ---------- Forwarded message ---------- From: Filipe G. Vieira Date: Mon, Jan 23, 2012 at 10:44 AM Subject: GSL mnultimin To: jonathan@leto.net, thierry.moisan@gmail.com Hi, I've just found your perl module to run GSL::multimin. I'm trying to use that functions in C++ but I have a doubt that, despite not related to the perl module, I thought you might be able to help me with. I want to limit the search space to [0,1] but the GSL function has no limit option. I tried to implement myself and I came up with two alternatives but I don't know if they are the best options. One is to just return a high score whenever the parameter goes out of the interval: if(gsl_vector_get(0,i) < min || gsl_vector_get(x,i) > max) return 1e100; The other is to set the parameter to 0: if(gsl_vector_get(0,i) < min) x->data[0] = min; if(gsl_vector_get(0,i) > max) x->data[0] = max; Are these approaches correct? Which one is the best? Any better way to do it? thanks, FGV -- Jonathan "Duke" Leto Leto Labs LLC 209.691.DUKE // http://labs.leto.net NOTE: Personal email is only checked twice a day at 10am/2pm PST, please call/text for time-sensitive matters.