Skip to content

Commit

Permalink
revise the ineq_constraints arg according to the revised Linear_Const…
Browse files Browse the repository at this point in the history
…raint class
  • Loading branch information
xuyuting committed Sep 17, 2024
1 parent 30dc2ec commit c53198e
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions demo/Constrained multi-output min-max.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"sys.path.insert(0,'../')\n",
"sys.path"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -143,7 +154,7 @@
"metadata": {},
"outputs": [],
"source": [
"from obsidian.constraints import InConstraint_Generic"
"from obsidian.constraints import Linear_Constraint"
]
},
{
Expand All @@ -163,7 +174,7 @@
"source": [
"X_suggest, eval_suggest = campaign.optimizer.suggest(acquisition = [{'NEHVI':{'ref_point':[-350, -20]}}, 'SF'],\n",
" # X1 + X2 <= 6, written as -X1 - X2 >= -6\n",
" ineq_constraints = [InConstraint_Generic(X_space, indices=[0,1], coeff=[-1,-1], rhs=-6)])"
" ineq_constraints = [Linear_Constraint(X_space, ind=[0,1], weights=[-1,-1], rhs=-6, equality=True)])"
]
},
{
Expand Down Expand Up @@ -210,7 +221,7 @@
"for iter in range(5):\n",
" campaign.fit()\n",
" X_suggest, eval_suggest = campaign.optimizer.suggest(acquisition = [{'NEHVI':{'ref_point':[-350, -20]}}, 'SF'],\n",
" ineq_constraints = [InConstraint_Generic(X_space, indices=[0,1], coeff=[-1,-1], rhs=-6)])\n",
" ineq_constraints = [Linear_Constraint(X_space, ind=[0,1], weights=[-1,-1], rhs=-6, equality=True)])\n",
" y_iter = pd.DataFrame(simulator.simulate(X_suggest))\n",
" Z_iter = pd.concat([X_suggest, y_iter, eval_suggest], axis=1)\n",
" campaign.add_data(Z_iter)"
Expand Down

0 comments on commit c53198e

Please sign in to comment.