[RBFOpt] Running example in RBFOpt
Giacomo Nannicini
giacomo.n at gmail.com
Wed Sep 23 21:24:14 EDT 2020
Make sure the file is in the proper location and the path is specified
in a way that Python understands it. Doesn't look correct at first
glance (slash missing).
G
On Wed, Sep 23, 2020 at 9:17 PM Chuong Thaidoan
<chuongthaidoan at gmail.com> wrote:
>
> Dear Giacomo,
> Thank you for your reply.
> I have re-ordered the settings of Path as follows, but the issue is still the same: Do you think Bonmin was not properly installed?
> Iter Cycle Action Objective value Time Gap
> ---- ----- ------ --------------- ---- ---
> 0 0 Initialization -0.782797 0.01 100.00 *
> 0 0 Initialization 69.095477 0.01 100.00
> 0 0 Initialization 20.000000 0.01 100.00
> 0 0 GlobalStep -9.829600 0.03 100.00 *
> 1 0 GlobalStep -9.946732 0.05 100.00 *
> 2 0 GlobalStep -0.133622 0.07 100.00
> 3 0 GlobalStep -8.304083 0.09 100.00
> 4 0 GlobalStep -9.999968 0.11 100.00 *
> Traceback (most recent call last):
> File "C:/Users/chuong/PycharmProjects/LearningPython/RBFOpt_test.py", line 15, in <module>
> val, x, itercount, evalcount, fast_evalcount = alg.optimize()
> File "C:\ProgramData\Anaconda3\lib\site-packages\rbfopt\rbfopt_algorithm.py", line 795, in optimize
> self.optimize_serial(pause_after_iters)
> File "C:\ProgramData\Anaconda3\lib\site-packages\rbfopt\rbfopt_algorithm.py", line 1056, in optimize_serial
> self.node_is_noisy)
> File "C:\ProgramData\Anaconda3\lib\site-packages\rbfopt\rbfopt_algorithm.py", line 2438, in local_step
> categorical_info, node_pos, rbf_lambda, rbf_h, node_pos[fmin_index])
> File "C:\ProgramData\Anaconda3\lib\site-packages\rbfopt\rbfopt_aux_problems.py", line 297, in minimize_rbf
> if (not opt.available()):
> File "C:\ProgramData\Anaconda3\lib\site-packages\pyomo\opt\base\solvers.py", line 99, in available
> raise pyutilib.common.ApplicationError("Solver (%s) not available" % str(self.name))
> pyutilib.common._exceptions.ApplicationError: Solver (bonmin) not available
>
> Process finished with exit code 1
>
> import numpy as np
> def obj_funct(x):
> return x[0]*x[1] - x[2]
>
> bb = rbfopt.RbfoptUserBlackBox(3, np.array([0] * 3), np.array([10] * 3),
> np.array(['R', 'I', 'R']), obj_funct)
> settings = rbfopt.RbfoptSettings(minlp_solver_path='c:Cygwin64/home/chuong/bonmin-stable/build/bonmin',\
> nlp_solver_path='c:Cygwin64/home/chuong/bonmin-stable/build/ipopt')
> #settings = rbfopt.RbfoptSettings(max_evaluations=50)
> alg = rbfopt.RbfoptAlgorithm(settings, bb)
> val, x, itercount, evalcount, fast_evalcount = alg.optimize()
>
>
> On Thu, Sep 24, 2020 at 10:59 AM Giacomo Nannicini <giacomo.n at gmail.com> wrote:
>>
>> Yes but in the code snippet you sent in the previous email, you are
>> then passing a different RbfoptSettings object to RbfoptAlgorithm --
>> not the one for which you set the path.
>>
>> On Wed, Sep 23, 2020 at 8:50 PM Chuong Thaidoan
>> <chuongthaidoan at gmail.com> wrote:
>> >
>> > Dear Giacomo,
>> > Thank you for your prompt reply. I already set the Path in the second line of the Python code, which is as follows:
>> >
>> > settings = rbfopt.RbfoptSettings(minlp_solver_path='/home/chuong/bonmin-stable/build/bonmin',\
>> > nlp_solver_path='/home/chuong/bonmin-stable/build/ipopt')
>> >
>> > or
>> >
>> > import rbfopt
>> > settings = rbfopt.RbfoptSettings(minlp_solver_path='Cygwin64/home/chuong/bonmin-stable/build/bonmin',\
>> > nlp_solver_path='Cygwin64/home/chuong/bonmin-stable/build/ipopt')
>> >
>> >
>> > On Thu, Sep 24, 2020 at 10:43 AM Giacomo Nannicini <giacomo.n at gmail.com> wrote:
>> >>
>> >> I do not understand the order of the code in the Python snippet.
>> >> If bonmin and ipopt are not in your part, you must set the
>> >> corresponding options in the RbfoptSettings object that is passed to
>> >> RbfoptAlgorithm.
>> >>
>> >> Giacomo
>> >>
>> >> On Wed, Sep 23, 2020 at 8:38 PM Chuong Thaidoan
>> >> <chuongthaidoan at gmail.com> wrote:
>> >> >
>> >> > Dear Giacomo,
>> >> > Thank you for your advice. I have just to re-install Bonmin and run the code. It shows errors as follows. Could you please take a look and let me know some further comments?
>> >> > Iter Cycle Action Objective value Time Gap
>> >> > ---- ----- ------ --------------- ---- ---
>> >> > 0 0 Initialization -0.782797 0.01 100.00 *
>> >> > 0 0 Initialization 69.095477 0.01 100.00
>> >> > 0 0 Initialization 20.000000 0.01 100.00
>> >> > 0 0 GlobalStep -9.829600 0.03 100.00 *
>> >> > 1 0 GlobalStep -9.946732 0.06 100.00 *
>> >> > 2 0 GlobalStep -0.133622 0.08 100.00
>> >> > 3 0 GlobalStep -8.304083 0.10 100.00
>> >> > 4 0 GlobalStep -9.999968 0.12 100.00 *
>> >> > Traceback (most recent call last):
>> >> > File "C:/Users/chuong/PycharmProjects/LearningPython/Ipopt/RBFOpt_test_ipopt.py", line 14, in <module>
>> >> > val, x, itercount, evalcount, fast_evalcount = alg.optimize()
>> >> > File "C:\ProgramData\Anaconda3\lib\site-packages\rbfopt\rbfopt_algorithm.py", line 795, in optimize
>> >> > self.optimize_serial(pause_after_iters)
>> >> > File "C:\ProgramData\Anaconda3\lib\site-packages\rbfopt\rbfopt_algorithm.py", line 1056, in optimize_serial
>> >> > self.node_is_noisy)
>> >> > File "C:\ProgramData\Anaconda3\lib\site-packages\rbfopt\rbfopt_algorithm.py", line 2438, in local_step
>> >> > categorical_info, node_pos, rbf_lambda, rbf_h, node_pos[fmin_index])
>> >> > File "C:\ProgramData\Anaconda3\lib\site-packages\rbfopt\rbfopt_aux_problems.py", line 297, in minimize_rbf
>> >> > if (not opt.available()):
>> >> > File "C:\ProgramData\Anaconda3\lib\site-packages\pyomo\opt\base\solvers.py", line 99, in available
>> >> > raise pyutilib.common.ApplicationError("Solver (%s) not available" % str(self.name))
>> >> > pyutilib.common._exceptions.ApplicationError: Solver (bonmin) not available
>> >> >
>> >> > Your code:
>> >> >
>> >> > import rbfopt
>> >> >
>> >> > settings = rbfopt.RbfoptSettings(minlp_solver_path='/home/chuong/bonmin-stable/build/bonmin',\
>> >> > nlp_solver_path='/home/chuong/bonmin-stable/build/ipopt')
>> >> >
>> >> > import numpy as np
>> >> > def obj_funct(x):
>> >> > return x[0]*x[1] - x[2]
>> >> >
>> >> > bb = rbfopt.RbfoptUserBlackBox(3, np.array([0] * 3), np.array([10] * 3),
>> >> > np.array(['R', 'I', 'R']), obj_funct)
>> >> > settings = rbfopt.RbfoptSettings(max_evaluations=50)
>> >> > alg = rbfopt.RbfoptAlgorithm(settings, bb)
>> >> > val, x, itercount, evalcount, fast_evalcount = alg.optimize()
>> >> >
>> >> >
>> >> > On Wed, Sep 23, 2020 at 11:43 PM Giacomo Nannicini <giacomo.n at gmail.com> wrote:
>> >> >>
>> >> >> You need both executables. You can download them from AMPL's website. If you compile from scratch, then Bonmin will also compile Ipopt.
>> >> >>
>> >> >> If the executables are not in the system path, you can specify their location via options.
>> >> >>
>> >> >>
>> >> >> G
>> >> >>
>> >> >>
>> >> >> On Wed, Sep 23, 2020, 9:36 AM Chuong Thaidoan <chuongthaidoan at gmail.com> wrote:
>> >> >>>
>> >> >>> Dear Giacomo,
>> >> >>> Thank you for your email. I am re-installing Bonmin because it still shows errors although I already specified the Path. Can I ask it is true that Bonmin contains Ipopt and so we only need to install Bonmin with Cygwin 64?
>> >> >>> Best regards,
>> >> >>> TD Chuong
>> >> >>>
>> >> >>> On Wed, Sep 23, 2020 at 10:46 PM Giacomo Nannicini <giacomo.n at gmail.com> wrote:
>> >> >>>>
>> >> >>>> Chuong,
>> >> >>>> please read the instruction manual, section 1.2. You need Bonmin and
>> >> >>>> Ipopt to be in your system path, or otherwise you need to specify
>> >> >>>> their location as options.
>> >> >>>>
>> >> >>>> Best,
>> >> >>>>
>> >> >>>> Giacomo
>> >> >>>>
>> >> >>>>
>> >> >>>>
>> >> >>>>
>> >> >>>> Dear the authors,
>> >> >>>> I am studying your interesting black-box function packages (RBFOpt),
>> >> >>>> and I just install it with Bonmin-1.8.8 solver via Cygwin64. I put
>> >> >>>> your "minimal working example" in Bonmin-1.8.8 folder and run it with
>> >> >>>> Pycharm. However, it shows errors
>> >> >>>> "pyutilib.common._exceptions.ApplicationError: Solver (bonmin) not
>> >> >>>> available".
>> >> >>>>
>> >> >>>> Could you please let me know some your advice? Thank you.
>> >> >>>> Best regards,
>> >> >>>> Chuong Thai Doan
>> >> >>>> Research Fellow at School of Information Technology
>> >> >>>> Deakin University, Melbourne, Australia
More information about the RBFOpt
mailing list