-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Fix bugs in the initialization step during the discrete optimization 2. Fix the bugs that index_set size equals zero during the discrete optimization 3. Now users can initialize sample set using “init_samples = [Solution(), …]“
- Loading branch information
1 parent
5779574
commit b404480
Showing
8 changed files
with
34 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import numpy as np | ||
from zoopt import Dimension, Objective, Parameter, ExpOpt, Solution, Opt | ||
from zoopt.utils.zoo_global import gl | ||
|
||
def fn(solution): | ||
x = solution.get_x() | ||
x1 = [0,3,1,0,0] | ||
# print(x) | ||
val = sum([abs(v-x1[i]) for i,v in enumerate(x)])+ ((np.sum([i for i in x[0:3]])-1.0)**2) | ||
return val | ||
|
||
dim = 5 | ||
gl.set_seed(0) | ||
dimobj = Dimension(dim, regs=[[0,5]]*dim, tys=[False]*dim) | ||
obj = Objective(fn, dimobj) | ||
param = Parameter(budget=1000) | ||
solution = Opt.min(obj, param) | ||
print(solution.get_x(), solution.get_value()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters