hypermapper icon indicating copy to clipboard operation
hypermapper copied to clipboard

example not running

Open hfahad opened this issue 2 years ago • 1 comments

i am trying to run example code but its not running:
.json file i already stored

` import math import os import sys import warnings from collections import OrderedDict from hypermapper import optimizer

def branin_function(X): x1 = X['x1'] x2 = X['x2'] a = 1.0 b = 5.1 / (4.0 * math.pi * math.pi) c = 5.0 / math.pi r = 6.0 s = 10.0 t = 1.0 / (8.0 * math.pi) y_value = a * (x2 - b * x1 * x1 + c * x1 - r) ** 2 + s * (1 - t) * math.cos(x1) + s return y_value

parameters_file = "branin_scenario.json" optimizer.optimize(parameters_file, branin_function) `

error

Design of experiment phase, number of new doe samples = 10 ....... x1,x2,Value,Timestamp 0,0,55.602112642270264,7 8.543484022566265,9.512681966559015,62.8853079104312,8 5.10496780984025,0.4285956412364236,14.334852172390551,9 7.698097723052356,3.2322340503099003,14.834434114253565,10 7.843639752982995,8.99902497476856,66.8723255894608,11 7.474348527914033,-0.29620203070807616,16.17437607950743,12 -3.5963990266596895,8.496483053313636,25.36680630262741,13 3.75028305422693,12.499465578089993,115.57253603919598,14 -0.18258074223477827,-2.0289763690178098,88.72930692695127,15 4.64157557815807,14.12682222155285,171.3974230123267,16

End of doe/resume phase, the number of evaluated configurations is: 10

Starting optimization iteration 1

AttributeError: Can't pickle local object 'Space.init..'

hfahad avatar Dec 19 '22 12:12 hfahad

Hey @hfahad ,

Sorry for the delay. We had an issue similar to this before and it was fixed in the past, can you share the information below so I can pinpoint the issue and check if it is the same issue?

  • Which HyperMapper version are you using?
  • What Pip and Python version are you using?
  • What OS are you running on? Previously we had this error on Windows 10 only, so this is important for us to reproduce the error.

Also, if you can, try adding this line to the json file and see if the issue persists:

"number_of_cpus": 1

Best, Artur Souza

arturluis avatar Jan 27 '23 20:01 arturluis