Skip to content

Constants not being passed into evaluate with AsynchronousXopt #195

Description

@ChristopherMayes

The constants are not being passed to evaluate with AsynchronousXopt. Example:

test.py

#from xopt import Xopt # Works
from xopt import AsynchronousXopt as Xopt

def evaluate_function(inputs, kwarg1, kwarg2):
    print(f"{inputs=}")

    assert 'constant1' in inputs
    assert 'constant2' in inputs

    outputs =  {'objective1': 1, 
     'objective2': 1,
     'constraint1':1,
     'constraint2':1}

    return outputs
     
 
YAML = f"""
 
max_evaluations: 10
generator:
  name: random
evaluator:
  function: __main__.evaluate_function
  function_kwargs:
    kwarg1: "test1.in"
    kwarg2: 3
 
vocs:
  variables:
    var1:           [1  ,   2] 
    var2:           [1  ,   2]
  constants:
    constant1: 'mm'
    constant2: 2

  objectives:
    objective1:   MINIMIZE  
    objective2:   MINIMIZE    
 
  constraints:
    constraint1: [GREATER_THAN,          100]
    constraint2: [LESS_THAN,             500]
 
"""
X = Xopt(YAML)

X.run()

Running:

python test.py
inputs={'var1': array([1.29934511]), 'var2': array([1.17955349])}
...
AssertionError

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions