Code Monkey home page Code Monkey logo

Comments (2)

ctribes avatar ctribes commented on July 28, 2024

We have a parameter called FIXED_VARIABLES for that.
https://nomad-4-user-guide.readthedocs.io/en/latest/AdvancedFunctionalities.html

And we have an example for Nomad in batch mode.
https://github.com/bbopt/nomad/blob/master/examples/advanced/batch/FixedVariable/param.txt

from nomad.jl.

salomonl avatar salomonl commented on July 28, 2024

@martinmestre The interface of the NOMAD software in Julia does not include the parameter FIXED_VARIABLES, because it is difficult to test it when combined with linear equality constraints (between others). You need to launch it only on non-fixed variables. However, the following example should do the deal:

import NOMAD

function bb1(x, p)
    sum1 = sum(cos.(x) .^ 4)
    sum2 = sum(x)
    sum3 = (1:length(x)) .* x
    prod1 = prod(cos.(x) .^ 2)
    prod2 = prod(x)
    g1 = -prod2 + 0.75
    g2 = sum2 - 7.5 * length(x)
    f = 10 * g1 + 10 * g2
    if (sum3  0.0)
        f -= abs((sum1 - 2 * prod1) / sqrt(3))
    end

    # scaling
    f *= 10^(-5) + p
    c2000 = -f - 2000 + p
    return (true, true, [g1; g2; f; c2000])
end

for param in [1.0, 2.0, 2.0, 3.0] #include two times 2.0 for reproducibility
    println("parameter = ", param, "\n")

    pb = NOMAD.NomadProblem(5, 4, ["PB"; "PB"; "OBJ"; "EB"],
                            x -> bb1(x, param))
    pb.options.max_bb_eval = 1000

    result = NOMAD.solve(pb, 7.0 * ones(Float64, 5))
end

On my machine, it returns:

parameter = 1.0

BBE OBJ
1 -168090.044939
A termination criterion is reached: No termination (all). Mesh minimum precision reached (Algo)

Best feasible solution:     Undefined.

Best infeasible solution:   #102716 ( 2.00166e-08 -222.807 6.07192 -97.4832 151.656 )	Evaluation OK	 f = -1999                     	 h =   0.122258619025000001

Blackbox evaluations:         851
Total model evaluations:      97312
Cache hits:                   78
Total number of evaluations:  929
parameter = 2.0

1 -336178.408995
324   -1994.428007
326   -1997.180223
351   -1997.953221
395   -1997.977435
462   -1997.999186
615   -1997.999481
636   -1997.999555
637   -1997.999774
659   -1997.999975
798   -1997.999977
816   -1997.999981
817   -1997.999995
909   -1997.999998
981   -1998
A termination criterion is reached: Maximum number of blackbox evaluations (Eval Global) 1000

Best feasible solution:     #177805 ( -3.75106e-06 -34.3587 -5.3168 27.9054 -50.2317 )	Evaluation OK	 f = -1998                     	 h =   0

Best infeasible solution:   #165855 ( -2.92766e-06 -34.3587 -5.31716 27.9054 -50.2499 )	Evaluation OK	 f = -1994.1627410000000964    	 h =   0.000000000001

Blackbox evaluations:         1000
Total model evaluations:      156157
Cache hits:                   98
Total number of evaluations:  1098
parameter = 2.0

1 -336178.408995
324   -1994.428007
326   -1997.180223
351   -1997.953221
395   -1997.977435
462   -1997.999186
615   -1997.999481
636   -1997.999555
637   -1997.999774
659   -1997.999975
798   -1997.999977
816   -1997.999981
817   -1997.999995
909   -1997.999998
981   -1998
A termination criterion is reached: Maximum number of blackbox evaluations (Eval Global) 1000

Best feasible solution:     #177805 ( -3.75106e-06 -34.3587 -5.3168 27.9054 -50.2317 )	Evaluation OK	 f = -1998                     	 h =   0

Best infeasible solution:   #165855 ( -2.92766e-06 -34.3587 -5.31716 27.9054 -50.2499 )	Evaluation OK	 f = -1994.1627410000000964    	 h =   0.000000000001

Blackbox evaluations:         1000
Total model evaluations:      156157
Cache hits:                   98
Total number of evaluations:  1098
parameter = 3.0

1 -504266.773051
332   -1996.036238
379   -1996.699164
457   -1996.744346
471   -1996.919412
535   -1996.98619
540   -1996.988497
589   -1996.999198
758   -1996.999977

BBE OBJ
891   -1996.999982
915   -1996.999996
A termination criterion is reached: Maximum number of blackbox evaluations (Eval Global) 1000

Best feasible solution:     #183997 ( -42.5891 8.98381 6.27354 0.000322763 -1.31333 )	Evaluation OK	 f = -1996.9999960000000101    	 h =   0

Best infeasible solution:   #189937 ( -42.6005 8.97419 6.27395 0.000233275 -1.3404 )	Evaluation OK	 f = -1990.3838189999999031    	 h =   0.000000000169

Blackbox evaluations:         1000
Total model evaluations:      174204
Cache hits:                   90
Total number of evaluations:  1090

Hope it helps ! We will add a remark in the documentation.

from nomad.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.