# forum.alglib.net

ALGLIB forum
 It is currently Sun Aug 14, 2022 9:53 am

 All times are UTC

### Forum rules

1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.

 Page 1 of 1 [ 3 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Boundary conditions in minlmPosted: Thu Oct 11, 2012 5:52 pm

Joined: Thu Oct 11, 2012 5:41 pm
Posts: 2
Has someone got a simple example of using minlmsetbc() in F#?

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

Top

 Post subject: Re: Boundary conditions in minlmPosted: Thu Oct 11, 2012 6:18 pm

Joined: Thu Oct 11, 2012 5:41 pm
Posts: 2
It's OK I've solved the problem - the setBC() call must be immediately before the optimize() with no other calls in between - the boundary conditions get overwritten otherwise.

N

Top

 Post subject: Re: Boundary conditions in minlmPosted: Fri Oct 12, 2012 5:32 am

Joined: Fri May 07, 2010 7:06 am
Posts: 878
Yes, minlmcreatev() re-initializes structure and erases all previous settings.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 3 posts ]

 All times are UTC

#### Who is online

Users browsing this forum: No registered users and 4 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for: