Has someone got a simple example of using minlmsetbc() in F#?
I've tried adding:
Code:
alglib.minlmsetbc(state, [|-1.;-1.|], [|5.;5.|])
to the minlm_d_v example, but it is just ignored.
Thanks.
Here's the code:
Code:
        let fi_errs (xs:double array) (fis:double array) o1 = 
            fis.[0] <- 10.*(xs.[0]+3.)**2.
            fis.[1] <- (xs.[1]-3.)**2. 
            ()           
        let mutable fis = [| 0.001; 0.01 |]
        let mutable init = [| 0.001; 0.02 |]
        let mins = [| -1.;-10.|]
        let maxs = [| 10.;10.|]
    
        let mutable state = new alglib.minlmstate()
        let mutable rep = new alglib.minlmreport()
        alglib.minlmsetbc(state, mins, maxs)
        let mvars = 2 // 2 variables
        let nopts = 2 // 2 functions in the sum
    
        AlgLib.alglib.minlmcreatev(mvars, nopts, init, 0.001, &state);
        let epsg = 0.0000001
        alglib.minlmsetcond(state, epsg, 0.0, 0.0, 0);//grad, func, xchange, maxiters
        alglib.minlmoptimize(state, (fun xs ->
                                                fun fis ->
                                                    fun o1 ->
                                                        fi_errs xs fis o1 
                                           ), null, null)
        AlgLib.alglib.minlmresults(state, &init, &rep);
        let out = rep.terminationtype