willu47 / amply Goto Github PK
View Code? Open in Web Editor NEWA Python package for AMPL/GMPL datafile parsing
License: Eclipse Public License 1.0
A Python package for AMPL/GMPL datafile parsing
License: Eclipse Public License 1.0
Hello again!
The Travis CI is giving an error on this specific python version for pulp. And from what I can see, it happens when installing amply. Can you see anything weird? (I have no idea what it means).
https://travis-ci.org/github/coin-or/pulp/jobs/700789057
For some reason it complains about a:
pkg_resources.DistributionNotFound: The 'setuptools-scm' distribution was not found and is required by the application
param default 1 : AvailabilityFactor :=
01_AUS POW_Other_Coal_PP 2017 0.0
results in a parsing error.
Amply doesn't allow numerical characters to start a symbol, and also does not allow underscores in names.
hey @willu47, did you manage to put amply in pypi so that we can add it as a dependency to pulp and close this issue? thanks!
Originally posted by @pchtsp in coin-or/pulp#246 (comment)
I used python 3.9 , and I try to install the apmly 0.1.4.
But I got the error:
Would please help me find it out?
Error in sys.excepthook:
Traceback (most recent call last):
File "c:\nobackup\anaconda3\envs\snakemake\lib\site-packages\otoole\cli.py", line 282, in exception_handler
print("{}: {}".format(exception_type.__name__, exception.message))
AttributeError: 'AmplyError' object has no attribute 'message'
Original exception was:
Traceback (most recent call last):
File "c:\nobackup\anaconda3\envs\snakemake\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\nobackup\anaconda3\envs\snakemake\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Nobackup\Anaconda3\envs\snakemake\Scripts\otoole.exe\__main__.py", line 7, in <module>
File "c:\nobackup\anaconda3\envs\snakemake\lib\site-packages\otoole\cli.py", line 287, in main
args.func(args)
File "c:\nobackup\anaconda3\envs\snakemake\lib\site-packages\otoole\cli.py", line 112, in result_matrix
input_data, _ = ReadDatafile().read(args.input_datafile)
File "c:\nobackup\anaconda3\envs\snakemake\lib\site-packages\otoole\read_strategies.py", line 212, in read
amply_datafile = self.read_in_datafile(filepath, config)
File "c:\nobackup\anaconda3\envs\snakemake\lib\site-packages\otoole\read_strategies.py", line 229, in read_in_datafile
datafile_parser.load_file(datafile)
File "c:\nobackup\anaconda3\envs\snakemake\lib\site-packages\amply\amply.py", line 817, in load_file
self.load_string(f.read())
File "c:\nobackup\anaconda3\envs\snakemake\lib\site-packages\amply\amply.py", line 806, in load_string
obj.eval(self)
File "c:\nobackup\anaconda3\envs\snakemake\lib\site-packages\amply\amply.py", line 305, in eval
self.name, self.tokens
amply.amply.AmplyError: Error in number of records of Peakdemand when reading ['param', 'Peakdemand', 'default', 1.0, [<SliceRecord: ('Kenya', '*', '*')>, <TabularRecord: {'TRLV_1_0': {2016.0: 0.0, 2017.0: 0.0, 2018.0: 0.0, 2019.0: 0.035503748, 2020.0: 0.073847796, 2021.0: 0.115202562, 2022.0: 0.159747552, 2023.0: 0.207671818, 2024.0: 0.259174428, 2025.0: 0.314464973, 2026.0: 0.373764082, 2027.0: 0.437303976, 2028.0: 0.437303976, 2029.0: 0.437303976, 2030.0: 0.437303976, 2031.0: 0.437303976, 2032.0: 0.437303976, 2033.0: 0.437303976, 2034.0: 0.437303976, 2035.0: 0.437303976, 2036.0: 0.437303976, 2037.0: 0.437303976, 2038.0: 0.437303976, 2039.0: 0.437303976, 2040.0: 0.437303976}, 'TRLV_2_0': {2016.0: 0.0, 2017.0: 0.0, 2018.0: 0.0, 2019.0: 0.031715426, 2020.0: 0.065968085, 2021.0: 0.102910213, 2022.0: 0.142702162, 2023.0: 0.18551281, 2024.0: 0.231519987, 2025.0: 0.280910918, 2026.0: 0.333882691, 2027.0: 0.390642748, 2028.0: 0.390642748, 2029.0: 0.390642748, 2030.0: 0.390642748, 2031.0: 0.390642748, 2032.0: 0.390642748, 2033.0: 0.390642748, 2034.0: 0.390642748, 2035.0: 0.390642748, 2036.0: 0.390642748, 2037.0: 0.390642748, 2038.0: 0.390642748, 2039.0: 0.390642748, 2040.0: 0.390642748}, 'TRLV_3_0': {2016.0: 0.0, 2017.0: 0.0, 2018.0: 0.0, 2019.0: 0.03760931, 2020.0: 0.078227364, 2021.0: 0.122034688, 2022.0: 0.169221434, 2023.0: 0.219987865, 2024.0: 0.274544855, 2025.0: 0.333114424, 2026.0: 0.395930287, 2027.0: 0.463238436, 2028.0: 0.463238436, 2029.0: 0.463238436, 2030.0: 0.463238436, 2031.0: 0.463238436, 2032.0: 0.463238436, 2033.0: 0.463238436, 2034.0: 0.463238436, 2035.0: 0.463238436, 2036.0: 0.463238436, 2037.0: 0.463238436, 2038.0: 0.463238436, 2039.0: 0.463238436, 2040.0: 0.463238436}, 'TRLV_4_0': {2016.0: 0.0, 2017.0: 0.0, 2018.0: 0.0, 2019.0: 0.052990896, 2020.0: 0.110221063, 2021.0: 0.171944858, 2022.0: 0.238430203, 2023.0: 0.309959264, 2024.0: 0.386829161, 2025.0: 0.469352715, 2026.0: 0.557859227, 2027.0: 0.652695296, 2028.0: 0.652695296, 2029.0: 0.652695296, 2030.0: 0.652695296, 2031.0: 0.652695296, 2032.0: 0.652695296, 2033.0: 0.652695296, 2034.0: 0.652695296, 2035.0: 0.652695296, 2036.0: 0.652695296, 2037.0: 0.652695296, 2038.0: 0.652695296, 2039.0: 0.652695296, 2040.0: 0.652695296}, 'TRLV_5_0': {2016.0: 0.0, 2017.0: 0.0, 2018.0: 0.0, 2019.0: 0.034974676, 2020.0: 0.072747325, 2021.0: 0.113485828, 2022.0: 0.157367014, 2023.0: 0.204577119, 2024.0: 0.255312244, 2025.0: 0.309778856, 2026.0: 0.368194298, 2027.0: 0.430787328, 2028.0: 0.430787328, 2029.0: 0.430787328, 2030.0: 0.430787328, 2031.0: 0.430787328, 2032.0: 0.430787328, 2033.0: 0.430787328, 2034.0: 0.430787328, 2035.0: 0.430787328, 2036.0: 0.430787328, 2037.0: 0.430787328, 2038.0: 0.430787328, 2039.0: 0.430787328, 2040.0: 0.430787328}, 'TRLV_6_0': {2016.0: 0.0, 2017.0: 0.0, 2018.0: 0.0, 2019.0: 0.037202401, 2020.0: 0.077380994, 2021.0: 0.12071435, 2022.0: 0.167390565, 2023.0: 0.217607735, 2024.0: 0.271574453, 2025.0: 0.329510336, 2026.0: 0.391646571, 2027.0: 0.458226488, 2028.0: 0.458226488, 2029.0: 0.458226488, 2030.0: 0.458226488, 2031.0: 0.458226488, 2032.0: 0.458226488, 2033.0: 0.458226488, 2034.0: 0.458226488, 2035.0: 0.458226488, 2036.0: 0.458226488, 2037.0: 0.458226488, 2038.0: 0.458226488, 2039.0: 0.458226488, 2040.0: 0.458226488}, 'TRLV_7_0': {2016.0: 0.0, 2017.0: 0.0, 2018.0: 0.0, 2019.0: 0.023055127, 2020.0: 0.047954664, 2021.0: 0.074809276, 2022.0: 0.103735529, 2023.0: 0.134856188, 2024.0: 0.168300522, 2025.0: 0.204204634, 2026.0: 0.242711793, 2027.0: 0.283972798, 2028.0: 0.283972798, 2029.0: 0.283972798, 2030.0: 0.283972798, 2031.0: 0.283972798, 2032.0: 0.283972798, 2033.0: 0.283972798, 2034.0: 0.283972798, 2035.0: 0.283972798, 2036.0: 0.283972798, 2037.0: 0.283972798, 2038.0: 0.283972798, 2039.0: 0.283972798, 2040.0: 0.283972798}, 'TRLV_8_0': {2016.0: 0.0, 2017.0: 0.0, 2018.0: 0.0, 2019.0: 0.029656132, 2020.0: 0.061684755, 2021.0: 0.096228218, 2022.0: 0.133436462, 2023.0: 0.1734674, 2024.0: 0.216487316, 2025.0: 0.262671276, 2026.0: 0.312203574, 2027.0: 0.365278182, 2028.0: 0.365278182, 2029.0: 0.365278182, 2030.0: 0.365278182, 2031.0: 0.365278182, 2032.0: 0.365278182, 2033.0: 0.365278182, 2034.0: 0.365278182, 2035.0: 0.365278182, 2036.0: 0.365278182, 2037.0: 0.365278182, 2038.0: 0.365278182, 2039.0: 0.365278182, 2040.0: 0.365278182}, 'TRLV_9_0': {2016.0: 0.0, 2017.0: 0.0, 2018.0: 0.0, 2019.0: 0.040579304, 2020.0: 0.084404952, 2021.0: 0.131671725, 2022.0: 0.182584792, 2023.0: 0.23736023, 2024.0: 0.296225567, 2025.0: 0.359420354, 2026.0: 0.427196764, 2027.0: 0.499820214, 2028.0: 0.499820214, 2029.0: 0.499820214, 2030.0: 0.499820214, 2031.0: 0.499820214, 2032.0: 0.499820214, 2033.0: 0.499820214, 2034.0: 0.499820214, 2035.0: 0.499820214, 2036.0: 0.499820214, 2037.0: 0.499820214, 2038.0: 0.499820214, 2039.0: 0.499820214, 2040.0: 0.499820214}}>]]
I have mixed input formats in my datafile for parameters. Some inputs are in matrix form and some are in "long" format.
I get the following Error message:
amply.amply.AmplyError: Error in number of records of Peakdemand
when reading the first parameter which is in matrix format.
Hello Will,
Could you make the AmplyError available outside of the package on top of offering the "Amply" object? I'm trying to take it out from pulp while keeping the tests to be sure everything is still possible.
Thanks!
Franco
In GNU MathProg files, legal syntax is to include enumeration over a set in a parameter definition subscript domain using x in set_name
. For example:
set REGION := Kenya;
set TECHNOLOGY := TRLV_1_0;
set YEAR := 2016 2017 2018 2019 2020;
param Peakdemand {r in REGION, t in TECHNOLOGY, y in YEAR};
However, this currently raises an error in amply. Omitting the in
statement works:
set REGION := Kenya;
set TECHNOLOGY := TRLV_1_0;
set YEAR := 2016 2017 2018 2019 2020;
param Peakdemand {REGION,TECHNOLOGY,YEAR};
Amply does not support symbolic parameters such as param month symbolic default ’May’ in {’Mar’, ’Apr’, ’May’};
or param resultpath symbolic default 'results' := 'results/path';
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.