Skip to content

Commit e331cb8

Browse files
committed
rename to pyprima
1 parent 50d935e commit e331cb8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+71
-71
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

primapy/profiles_vs_python_bindings/profiles.py renamed to pyprima/profiles_vs_python_bindings/profiles.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
'rhoend' : 3.14*1.0e-4,
1616
}
1717

18-
def get_primapy_options(n, f0):
18+
def get_pyprima_options(n, f0):
1919
if os.environ.get('NONDEFAULT_PRIMAPY') == 'True':
2020
options = nondefault_options(n, f0)
2121
# Change the option name
@@ -30,8 +30,8 @@ def get_python_options(n, f0):
3030
return {}
3131

3232

33-
def primapy_cobyla(fun, x0, lb, ub, a_ub, b_ub, a_eq, b_eq, c_ub, c_eq):
34-
from primapy import minimize, Bounds, LinearConstraint, NonlinearConstraint
33+
def pyprima_cobyla(fun, x0, lb, ub, a_ub, b_ub, a_eq, b_eq, c_ub, c_eq):
34+
from pyprima import minimize, Bounds, LinearConstraint, NonlinearConstraint
3535

3636
f0 = fun.__self__._fun(x0)
3737
bounds = Bounds(lb, ub)
@@ -46,7 +46,7 @@ def primapy_cobyla(fun, x0, lb, ub, a_ub, b_ub, a_eq, b_eq, c_ub, c_eq):
4646
c_eq_x0 = c_eq(x0)
4747
if c_eq_x0.size > 0:
4848
constraints.append(NonlinearConstraint(c_eq, np.zeros_like(c_eq_x0), np.zeros_like(c_eq_x0)))
49-
options = get_primapy_options(len(x0), f0)
49+
options = get_pyprima_options(len(x0), f0)
5050
if 'npt' in options:
5151
del options['npt']
5252
result = minimize(fun, x0, method='cobyla', bounds=bounds, constraints=constraints, options=options)
@@ -90,7 +90,7 @@ def get_problems(description):
9090
args = parser.parse_args()
9191

9292

93-
def run_three_benchmarks(primapy_fun, python_fun, algorithm, cutest_problem_names, default_only, n_jobs):
93+
def run_three_benchmarks(pyprima_fun, python_fun, algorithm, cutest_problem_names, default_only, n_jobs):
9494
'''
9595
Proper validation of both default and nondefault options requires 3 runs: Both default, both nondefault, and
9696
one default one nondefault. The first two should look identical, and so the third run confirms that our
@@ -104,19 +104,19 @@ def run_three_benchmarks(primapy_fun, python_fun, algorithm, cutest_problem_name
104104
project_x0 = algorithm == 'lincoa'
105105
os.environ['NONDEFAULT_PRIMAPY'] = "False"
106106
os.environ['NONDEFAULT_PYTHON'] = "False"
107-
run_benchmark([primapy_fun, python_fun], [f'PyPRIMA-{ALGORITHM}', f'Python-{ALGORITHM}'], cutest_problem_names, benchmark_id=f'{algorithm}_default_options', n_jobs=n_jobs, project_x0=project_x0)
107+
run_benchmark([pyprima_fun, python_fun], [f'PyPRIMA-{ALGORITHM}', f'Python-{ALGORITHM}'], cutest_problem_names, benchmark_id=f'{algorithm}_default_options', n_jobs=n_jobs, project_x0=project_x0)
108108
if not default_only:
109109
os.environ['NONDEFAULT_PRIMAPY'] = "True"
110110
os.environ['NONDEFAULT_PYTHON'] = "True"
111-
run_benchmark([primapy_fun, python_fun], [f'PyPRIMA-{ALGORITHM}', f'Python-{ALGORITHM}'], cutest_problem_names, benchmark_id=f'{algorithm}_nondefault_options', n_jobs=n_jobs, project_x0=project_x0)
111+
run_benchmark([pyprima_fun, python_fun], [f'PyPRIMA-{ALGORITHM}', f'Python-{ALGORITHM}'], cutest_problem_names, benchmark_id=f'{algorithm}_nondefault_options', n_jobs=n_jobs, project_x0=project_x0)
112112
os.environ['NONDEFAULT_PRIMAPY'] = "True"
113113
os.environ['NONDEFAULT_PYTHON'] = "False"
114-
run_benchmark([primapy_fun, python_fun], [f'PyPRIMA-{ALGORITHM}', f'Python-{ALGORITHM}'], cutest_problem_names, benchmark_id=f'{algorithm}_different_options', n_jobs=n_jobs, project_x0=project_x0)
114+
run_benchmark([pyprima_fun, python_fun], [f'PyPRIMA-{ALGORITHM}', f'Python-{ALGORITHM}'], cutest_problem_names, benchmark_id=f'{algorithm}_different_options', n_jobs=n_jobs, project_x0=project_x0)
115115

116116
start = time()
117117
print("Running profiles for COBYLA")
118118
with open('cobyla.txt') as f:
119119
cutest_problem_names = f.read().splitlines()
120120
cutest_problem_names = list(filter(lambda x: x not in excludelist('cobyla'), cutest_problem_names))
121-
run_three_benchmarks(primapy_cobyla, python_cobyla, 'cobyla', cutest_problem_names, args.default_only, args.n_jobs)
121+
run_three_benchmarks(pyprima_cobyla, python_cobyla, 'cobyla', cutest_problem_names, args.default_only, args.n_jobs)
122122
print(f'Completed COBYLA profile in {time() - start:.2f} seconds')
File renamed without changes.

0 commit comments

Comments
 (0)