Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
exclude = .git,__pycache__,venv
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# WIP
1. add a threshold
2. test with additional functions
3. continue test driven development of best_candidate...

# scisample

`scisample` is a Python 3 package that implements a number of parameter
Expand Down Expand Up @@ -25,7 +30,7 @@ are written in the YAML markup language.
1. `pytest tests`
1. `pytest --cov=scisample tests/`

# Community
# Community

`scisample` is an open source project. Questions, discussion, and
contributions are welcome. Contributions can be anything from new
Expand All @@ -40,7 +45,7 @@ branch on the scisample repository.
Your PR must pass `scisamples`'s unit tests and documentation tests, and
must pass most `flake8` and `pylint` tests. We enforce these guidelines
with our CI process. Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for
more information.
more information.

# Code of Conduct

Expand Down
7 changes: 5 additions & 2 deletions bin/pgen_scisample.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ def get_custom_generator(env, **kwargs):
except ValueError:
raise Exception("this pgen code requires SAMPLE_DICTIONARY " +
"to be defined in the yaml specification")

return new_sampler(SAMPLE_DICTIONARY).maestro_pgen


def main():
""" main """
print("This script needs to be used by maestrowf.")
print("Please visit https://github.com/LLNL/maestrowf for more information.")
print(
"Please visit https://github.com/LLNL/maestrowf for more information.")


if __name__ == "__main__":
# execute only if run as a script
Expand Down
1 change: 1 addition & 0 deletions examples/codepy_simple/codepy_config_random.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# run this with codepy run . -c codepy_config_random.yaml

setup:
Expand Down
66 changes: 66 additions & 0 deletions examples/python_api/chat_gpt_code.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Value (loc): 5\n",
"Value (iloc): 5\n"
]
}
],
"source": [
"import pandas as pd\n",
"\n",
"# Create a sample DataFrame\n",
"df = pd.DataFrame({\n",
" 'A': [1, 2, 3],\n",
" 'B': [4, 5, 6],\n",
" 'C': [7, 8, 9]\n",
"})\n",
"\n",
"# Get value by row and column label using loc\n",
"value_loc = df.loc[1, 'B']\n",
"print(\"Value (loc):\", value_loc)\n",
"\n",
"# Get value by row and column index using iloc\n",
"value_iloc = df.iloc[1, 1]\n",
"print(\"Value (iloc):\", value_iloc)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "venv_scisample",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.8"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
77 changes: 77 additions & 0 deletions examples/python_api/minimization_test_functions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@

https://en.wikipedia.org/wiki/Test_functions_for_optimization

2D functions to test minimization routines on

ChatGPT
Certainly! Here are some commonly used 2D functions to test minimization routines:

Booth's Function:
python
Copy code
def booth(x):
""" Booth's function """
return (x[0] + 2*x[1] - 7)**2 + (2*x[0] + x[1] - 5)**2
Himmelblau's Function:
python
Copy code
def himmelblau(x):
""" Himmelblau's function """
return (x[0]**2 + x[1] - 11)**2 + (x[0] + x[1]**2 - 7)**2
Beale's Function:
python
Copy code
def beale(x):
""" Beale's function """
return (1.5 - x[0] + x[0]*x[1])**2 + (2.25 - x[0] + x[0]*x[1]**2)**2 + \
(2.625 - x[0] + x[0]*x[1]**3)**2
Goldstein-Price Function:
python
Copy code
def goldstein_price(x):
""" Goldstein-Price function """
return (1 + (x[0] + x[1] + 1)**2 *
(19 - 14*x[0] + 3*x[0]**2 - 14*x[1] + 6*x[0]*x[1] + 3*x[1]**2)) * \
(30 + (2*x[0] - 3*x[1])**2 *
(18 - 32*x[0] + 12*x[0]**2 + 48*x[1] - 36*x[0]*x[1] + 27*x[1]**2))
These functions provide different optimization challenges such as multiple local minima, narrow valleys, and non-convex shapes. They can be used to evaluate the performance and behavior of minimization routines on 2D problems.

Feel free to choose any of these functions or explore other 2D benchmark functions based on your specific needs.





User
which of these have global minima
ChatGPT
Among the functions mentioned:

Booth's Function: It has a single global minimum at (1, 3), with a function value of 0.

Himmelblau's Function: It has four symmetric global minima, each located at one of the four corners of the square: (3, 2), (-2.805118, 3.131312), (-3.779310, -3.283186), and (3.584428, -1.848126), with a function value of 0.

Beale's Function: It has a global minimum at (3, 0.5), with a function value of 0.

Goldstein-Price Function: It has a global minimum at (0, -1), with a function value of 3.

These functions exhibit different global minima and can be used to test the ability of minimization routines to find the optimal solutions.





User
which have local minima
ChatGPT
Among the functions mentioned:

Booth's Function: It does not have any local minima other than the global minimum at (1, 3).

Himmelblau's Function: It has multiple local minima in addition to the global minima. These local minima are located in various regions of the function's landscape.

Beale's Function: It does not have any local minima other than the global minimum at (3, 0.5).

Goldstein-Price Function: It has multiple local minima in addition to the global minimum. These local minima are located in various regions of the function's landscape.

Himmelblau's Function and Goldstein-Price Function are known for having multiple local minima, which can make the optimization process more challenging as the minimization routine needs to avoid getting trapped in these local minima and find the global minimum instead.
Loading