Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0.0 rc0 #67

Merged
merged 37 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9e77c37
update pandas v in readme installation instructions; update v number …
MichaelPesce Jun 27, 2024
6513263
update pands functions to work with 2.0
MichaelPesce Jun 27, 2024
1889df9
add error handling to kpidashboard
MichaelPesce Jun 27, 2024
efaecd4
multiply reuse rate by 100 before rounding; fix names in overview table
MichaelPesce Jun 28, 2024
479a35f
update category names for new output categories
MichaelPesce Jun 28, 2024
4bf9c68
move descriptions to separate file
MichaelPesce Jun 28, 2024
8335f2a
add new objectives, make this a dropdown now
MichaelPesce Jun 28, 2024
8980534
add new optimization settings
MichaelPesce Jun 28, 2024
118950e
add additional settings
MichaelPesce Jun 28, 2024
0ef69b9
harden method for getting optimization settings on backend from reque…
MichaelPesce Jun 28, 2024
dcab594
store advanced options data in separate file
MichaelPesce Jun 28, 2024
a80cddf
use pipeline_cost instead of pipelineCostCalculation
MichaelPesce Jun 28, 2024
54ccf64
change conditional from any falsy to null or undefined
MichaelPesce Jun 28, 2024
311ece3
update descriptions for new stuff
MichaelPesce Jun 28, 2024
1f77cfd
update mock scenario data
MichaelPesce Jun 28, 2024
9ceda27
add pint to requirements
MichaelPesce Jun 28, 2024
9c68802
update version numbers, use env variable for pareto version
MichaelPesce Jun 28, 2024
f217b17
mve idaes get extensions
MichaelPesce Jun 28, 2024
651b2b9
fix directory for env variable; manually install pint
MichaelPesce Jun 28, 2024
51f5d0f
display pip packages
MichaelPesce Jun 28, 2024
be2f15a
try 0.23
MichaelPesce Jun 28, 2024
588f8b7
specify pint version in requirements
MichaelPesce Jun 28, 2024
f2f2e64
build 1.0rc1
MichaelPesce Jun 28, 2024
45c2953
use 1.0.0rc1 workshop file for e2e testing
MichaelPesce Jun 28, 2024
7fa430d
add pkg_resources.extern to hidden imports
MichaelPesce Jun 28, 2024
08b5b0d
update idaes extensions for mac
MichaelPesce Jun 28, 2024
9383c5b
use idaes 2.4.0, pyomo 6.7.1
MichaelPesce Jun 28, 2024
04816af
issues with port crawling, just use 50011 for now
MichaelPesce Jun 28, 2024
2a813bb
update to data version #3
MichaelPesce Jun 28, 2024
4bdf7f4
use 1.0.0rc1 for backend build
MichaelPesce Jun 28, 2024
7c51c85
fix order
MichaelPesce Jun 28, 2024
3be8c4d
add requirements-build.txt
MichaelPesce Jun 28, 2024
cf4e709
use requirements-build.txt for exact python package versions
MichaelPesce Jun 28, 2024
8140119
remove macos tensorflow
MichaelPesce Jun 29, 2024
4019f40
build with project-pareto-main
MichaelPesce Jul 1, 2024
0b80067
update version numbers; build with project-pareto main
MichaelPesce Jul 1, 2024
f59d0e4
change v back to 1.0.0rc1; update excel file for e2e test
MichaelPesce Jul 3, 2024
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
25 changes: 18 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: App build
on:
push:
branches:
- "jan-release"
- "1.0rc0"

defaults:
run:
Expand All @@ -30,22 +30,33 @@ jobs:
run: |
dotnet tool install --global AzureSignTool

- name: Add project pareto version to .env file
working-directory: ./electron/ui
run: |
echo REACT_APP_PARETO_VERSION=1.0.0rc1 >> .env

- name: Install Electron JS dependencies
run: |
npm --prefix electron clean-install
- name: Install frontend JS dependencies
run: |
npm --prefix electron/ui clean-install

- name: Get idaes extensions
run: idaes get-extensions

- name: Install Pareto locally
# - name: Install correct tag of pareto
# working-directory: ../
# run: git clone https://github.com/project-pareto/project-pareto.git && cd project-pareto && git fetch --all --tags && git checkout tags/1.0.0 -b 1.0.0 && pip install --progress-bar off .

- name: Install correct branch of pareto
working-directory: ../
run: git clone https://github.com/MichaelPesce/project-pareto.git && cd project-pareto && pip install --progress-bar off .
run: git clone https://github.com/project-pareto/project-pareto.git && cd project-pareto && pip install --progress-bar off .

- name: Install numpy 1.24.3
- name: Install build requirements
working-directory: ./backend
run: |
pip uninstall -y numpy && pip install numpy==1.24.3
pip install -r requirements-build.txt

- name: Build Backend
run: npm --prefix electron run build-backend
Expand All @@ -58,12 +69,12 @@ jobs:

- name: Sign Windows Distribution
run: |
AzureSignTool sign -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.digicert.com -v electron/dist/ParetoUI-24.01.24-win64.exe
AzureSignTool sign -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.digicert.com -v electron/dist/ParetoUI-24.07.01-win64.exe

- name: Upload artifact for windows build
uses: actions/upload-artifact@v4
if: always()
with:
name: windows-pareto-dist
path: |
electron/dist/ParetoUI-24.01.24-win64.exe
electron/dist/ParetoUI-24.07.01-win64.exe
14 changes: 11 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ jobs:
miniforge-version: latest
activate-environment: pareto-ui-env

- name: Add project pareto version to .env file
working-directory: ./electron/ui
run: |
echo REACT_APP_PARETO_VERSION=1.0.0rc1 >> .env

# - name: Install pint
# run: pip install pint==0.23

- name: get idaes extensions
run: idaes get-extensions

- name: Install correct branch of pareto
working-directory: ../
run: git clone https://github.com/project-pareto/project-pareto.git && cd project-pareto && pip install --progress-bar off .
Expand All @@ -50,9 +61,6 @@ jobs:
run: |
npm --prefix electron/ui clean-install

- name: get idaes extensions
run: idaes get-extensions

- name: run component tests
run: npm --prefix electron/ui test

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pip uninstall -y numpy pandas
### 3. Install osx/arm64 versions of numpy and pandas

```sh
conda install -y -c conda-forge/osx-arm64 numpy pandas=1.4.0
conda install -y -c conda-forge/osx-arm64 numpy pandas=2.0.3
```

### 4. Install the IDAES solver dependencies
Expand Down
4 changes: 2 additions & 2 deletions backend/app/internal/get_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _read_data(_fname, _set_list, _parameter_list):
header=0,
index_col=None,
usecols="A",
squeeze=True,
# squeeze=True,
dtype="string",
keep_default_na=False,
)
Expand All @@ -59,7 +59,7 @@ def _read_data(_fname, _set_list, _parameter_list):
header=1,
index_col=None,
usecols=None,
squeeze=True,
# squeeze=True,
keep_default_na=False,
)
# A parameter can be defined in column format or table format.
Expand Down
29 changes: 19 additions & 10 deletions backend/app/internal/pareto_stategic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
PipelineCost,
PipelineCapacity,
Hydraulics,
WaterQuality
WaterQuality,
RemovalEfficiencyMethod,
InfrastructureTiming,
SubsurfaceRisk,
DesalinationModel
)
from pyomo.opt import TerminationCondition
from pareto.utilities.get_data import get_data
Expand All @@ -49,18 +53,23 @@ def run_strategic_model(input_file, output_file, id, modelParameters, overrideVa
[df_sets, df_parameters] = get_data(input_file, set_list, parameter_list)

_log.info(f"creating model")
strategic_model = create_model(
df_sets,
df_parameters,
default={
default={
"objective": Objectives[modelParameters["objective"]],
"pipeline_cost": PipelineCost[modelParameters["pipelineCost"]],
"pipeline_capacity": PipelineCapacity.input,
"node_capacity": True,
"water_quality": WaterQuality[modelParameters["waterQuality"]],
"pipeline_cost": PipelineCost[modelParameters["pipeline_cost"]],
"pipeline_capacity": PipelineCapacity[modelParameters["pipeline_capacity"]],
"node_capacity": modelParameters["node_capacity"],
"water_quality": WaterQuality[modelParameters["water_quality"]],
"hydraulics": Hydraulics[modelParameters["hydraulics"]],
"removal_efficiency_method": RemovalEfficiencyMethod[modelParameters["removal_efficiency_method"]],
"infrastructure_timing": InfrastructureTiming[modelParameters["infrastructure_timing"]],
"subsurface_risk": SubsurfaceRisk[modelParameters["subsurface_risk"]],
"desalination_model": DesalinationModel[modelParameters["desalination_model"]],
# "build_units": BuildUnits[modelParameters["build_units"]]
},
}
strategic_model = create_model(
df_sets,
df_parameters,
default=default
)

scenario = scenario_handler.get_scenario(int(id))
Expand Down
8 changes: 4 additions & 4 deletions backend/app/internal/scenario_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
class ScenarioHandler:
"""Manage the saved scenarios."""

VERSION = 2
VERSION = 3
SCENARIO_DB_FILE = f"scenarios.json"
LOCKED = False

Expand Down Expand Up @@ -231,7 +231,7 @@ def upload_excelsheet(self, output_path, scenarioName, filename, kmz_data=None):

# convert pandas series into lists
for key in df_sets:
df_sets[key] = df_sets[key].tolist()
df_sets[key] = df_sets[key].values.tolist()

# create scenario object
current_day = datetime.date.today()
Expand All @@ -249,7 +249,7 @@ def upload_excelsheet(self, output_path, scenarioName, filename, kmz_data=None):
{
"objective":"cost",
"runtime": 900,
"pipelineCostCalculation": "distance_based",
"pipeline_cost": "distance_based",
"waterQuality": "false",
"hydraulics": "false",
"solver": "cbc",
Expand Down Expand Up @@ -321,7 +321,7 @@ def replace_excelsheet(self, output_path, id):

# convert pandas series into lists
for key in df_sets:
df_sets[key] = df_sets[key].tolist()
df_sets[key] = df_sets[key].values.tolist()

scenario = self.get_scenario(id)
scenario["results"]["status"] = "Draft"
Expand Down
28 changes: 14 additions & 14 deletions backend/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@

def getPort():
port = 50011
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
foundOpenPort = False
while not foundOpenPort:
try:
s.bind(("127.0.0.1", port))
_log.info(f"found open port: {port}")
foundOpenPort = True
except socket.error as e:
if e.errno == errno.EADDRINUSE:
_log.info(f"Port {port} is already in use")
else:
_log.error(f"Error while trying to connect to port {port}: {e}")
port += 1
s.close()
# s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# foundOpenPort = False
# while not foundOpenPort:
# try:
# s.bind(("127.0.0.1", port))
# _log.info(f"found open port: {port}")
# foundOpenPort = True
# except socket.error as e:
# if e.errno == errno.EADDRINUSE:
# _log.info(f"Port {port} is already in use")
# else:
# _log.error(f"Error while trying to connect to port {port}: {e}")
# port += 1
# s.close()
return port

if __name__ == '__main__':
Expand Down
19 changes: 9 additions & 10 deletions backend/app/main.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,28 @@ block_cipher = None

idaes_path = str(Path.home() / ".idaes")

if sys.platform == 'darwin':
if sys.platform == 'darwin':
extra_data = [
(f'{idaes_path}/bin/ipopt_sens', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/cubic_roots.so', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/ipopt_sens', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/cubic_roots.dylib', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/libstdc++.6.dylib', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/version_lib.txt', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/libsipopt.dylib', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/libadolc.2.dylib', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/general_helmholtz_external.so', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/libadolc.dylib', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/libipopt.3.dylib', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/libadolc.la', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/libsipopt.dylib', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/libquadmath.0.dylib', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/general_helmholtz_external.dylib', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/libipopt.3.dylib', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/ipopt', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/couenne', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/libipopt.dylib', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/cbc', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/libgfortran.5.dylib', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/libpynumero_ASL.dylib', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/functions.so', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/iapws95_external.so', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/functions.dylib', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/bonmin', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/license_lib.txt', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/k_aug', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/version_solvers.txt', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/ipopt_l1', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/bonmin', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/swco2_external.so', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/libsipopt.3.dylib', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/license.txt', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/ipopt_sens_l1', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/libgcc_s.1.1.dylib', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/clp', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/libgomp.1.dylib', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/dot_sens', 'extensions/.idaes/bin/')]
elif sys.platform == 'linux':
extra_data = [
(f'{idaes_path}/bin/ipopt_sens', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/cubic_roots.so', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/ipopt_sens', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/libadolc.so', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/version_lib.txt', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/libadolc.so.2', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/libadolc.so.2.2.0', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/general_helmholtz_external.so', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/libipopt.so', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/libipopt.so', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/libpynumero_ASL.so', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/libadolc.la', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/ipopt', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/couenne', 'extensions/.idaes/bin/'),
(f'{idaes_path}/bin/libsipopt.so', 'extensions/.idaes/bin/'), (f'{idaes_path}/bin/cbc', 'extensions/.idaes/bin/'),
Expand Down Expand Up @@ -59,7 +57,8 @@ a = Analysis(
'pint',
'numbers',
'pyutilib',
'pyomo'],
'pyomo',
'pkg_resources.extern'],
hookspath=['extra-hooks'],
hooksconfig={},
runtime_hooks=[],
Expand Down
27 changes: 16 additions & 11 deletions backend/app/routers/scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,24 @@ async def run_model(request: Request, background_tasks: BackgroundTasks):
try:
excel_path = "{}/{}.xlsx".format(scenario_handler.excelsheets_path,data['scenario']['id'])
output_path = "{}/{}.xlsx".format(scenario_handler.outputs_path,data['scenario']['id'])
optimizationSettings = data['scenario']['optimization']
modelParameters = {
"objective": data['scenario']['optimization']['objective'],
"runtime": data['scenario']['optimization']['runtime'],
"pipelineCost": data['scenario']['optimization']['pipelineCostCalculation'],
"waterQuality": data['scenario']['optimization']['waterQuality']
"objective": optimizationSettings.get('objective',"cost"),
"runtime": optimizationSettings.get('runtime',900),
"pipeline_cost": optimizationSettings.get("pipeline_cost", "distance_based"),
"pipeline_capacity": optimizationSettings.get("pipeline_capacity", "input"),
"node_capacity": optimizationSettings.get("node_capacity", True),
"water_quality": optimizationSettings.get("waterQuality", "false"),
"solver": optimizationSettings.get('solver',None),
"build_units": optimizationSettings.get('build_units',"user_units"),
"optimalityGap": optimizationSettings.get("optimalityGap", 5),
"scale_model": optimizationSettings.get("scale_model", True),
"hydraulics": optimizationSettings.get('hydraulics',"false"),
"removal_efficiency_method": optimizationSettings.get('removal_efficiency_method',"concentration_based"),
"desalination_model": optimizationSettings.get("desalination_model", "false"),
"infrastructure_timing": optimizationSettings.get("infrastructure_timing", "false"),
"subsurface_risk": optimizationSettings.get("subsurface_risk", "false"),
}
defaultParams = {'solver': None, 'build_units': 'user_units', 'optimalityGap': 5, 'scale_model': True, 'hydraulics': 'false'}
for param in ['solver', 'build_units', 'optimalityGap', 'scale_model', 'hydraulics']:
try:
modelParameters[param]=data['scenario']['optimization'][param]
except:
_log.error(f'unable to find {param}, using {defaultParams[param]}')
modelParameters[param]=defaultParams[param]

_log.info(f"modelParameters: {modelParameters}")

Expand Down
Loading