diff --git a/checkpy3.sh b/checkpy3.sh index 1dbaff4e6..e03529b64 100755 --- a/checkpy3.sh +++ b/checkpy3.sh @@ -1,5 +1,5 @@ cp gpkit/env/settings . sed -i '1s/.*/installed_solvers : mosek_cli/' gpkit/env/settings cat gpkit/env/settings -python3 -c "import gpkit.tests; gpkit.tests.helpers.run_tests(gpkit.tests.t_examples.TESTS)" +python3 -c docs/source/examples/simpleflight.py mv settings gpkit/env diff --git a/docs/source/autodoc/gpkit.constraints.rst b/docs/source/autodoc/gpkit.constraints.rst index b2b09369f..37e84ae57 100644 --- a/docs/source/autodoc/gpkit.constraints.rst +++ b/docs/source/autodoc/gpkit.constraints.rst @@ -28,18 +28,10 @@ gpkit.constraints.costed module :undoc-members: :show-inheritance: -gpkit.constraints.geometric_program module ------------------------------------------- +gpkit.constraints.gp module +--------------------------- -.. automodule:: gpkit.constraints.geometric_program - :members: - :undoc-members: - :show-inheritance: - -gpkit.constraints.linked module -------------------------------- - -.. automodule:: gpkit.constraints.linked +.. automodule:: gpkit.constraints.gp :members: :undoc-members: :show-inheritance: @@ -76,18 +68,18 @@ gpkit.constraints.set module :undoc-members: :show-inheritance: -gpkit.constraints.sigeq module ------------------------------- +gpkit.constraints.sgp module +---------------------------- -.. automodule:: gpkit.constraints.sigeq +.. automodule:: gpkit.constraints.sgp :members: :undoc-members: :show-inheritance: -gpkit.constraints.signomial_program module ------------------------------------------- +gpkit.constraints.sigeq module +------------------------------ -.. automodule:: gpkit.constraints.signomial_program +.. automodule:: gpkit.constraints.sigeq :members: :undoc-members: :show-inheritance: diff --git a/docs/source/autodoc/gpkit.nomials.rst b/docs/source/autodoc/gpkit.nomials.rst index b5212e60a..39def6397 100644 --- a/docs/source/autodoc/gpkit.nomials.rst +++ b/docs/source/autodoc/gpkit.nomials.rst @@ -12,6 +12,14 @@ gpkit.nomials.array module :undoc-members: :show-inheritance: +gpkit.nomials.core module +------------------------- + +.. automodule:: gpkit.nomials.core + :members: + :undoc-members: + :show-inheritance: + gpkit.nomials.data module ------------------------- @@ -20,18 +28,18 @@ gpkit.nomials.data module :undoc-members: :show-inheritance: -gpkit.nomials.nomial_core module --------------------------------- +gpkit.nomials.map module +------------------------ -.. automodule:: gpkit.nomials.nomial_core +.. automodule:: gpkit.nomials.map :members: :undoc-members: :show-inheritance: -gpkit.nomials.nomial_math module --------------------------------- +gpkit.nomials.math module +------------------------- -.. automodule:: gpkit.nomials.nomial_math +.. automodule:: gpkit.nomials.math :members: :undoc-members: :show-inheritance: diff --git a/docs/source/autodoc/gpkit.rst b/docs/source/autodoc/gpkit.rst index c38ddaa5f..3dba47919 100644 --- a/docs/source/autodoc/gpkit.rst +++ b/docs/source/autodoc/gpkit.rst @@ -3,6 +3,9 @@ Glossary *For an alphabetical listing of all commands, check out the* :ref:`genindex` +gpkit package +============= + Subpackages ----------- diff --git a/docs/source/citinggpkit.rst b/docs/source/citinggpkit.rst index d921cd71e..b61081efc 100644 --- a/docs/source/citinggpkit.rst +++ b/docs/source/citinggpkit.rst @@ -8,5 +8,5 @@ If you use GPkit, please cite it with the following bibtex:: title={GPkit software for geometric programming}, howpublished={\url{https://github.com/convexengineering/gpkit}}, year={2017}, - note={Version 0.5.3} + note={Version 0.6.0} } diff --git a/docs/source/conf.py b/docs/source/conf.py index 5ff57e336..7bf1d53b1 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -55,9 +55,9 @@ # built documents. # # The short X.Y version. -version = '0.5' +version = '0.6' # The full version, including alpha/beta/rc tags. -release = '0.5.3' +release = '0.6.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/source/releasenotes.rst b/docs/source/releasenotes.rst index a7fd360c7..52a6afe87 100644 --- a/docs/source/releasenotes.rst +++ b/docs/source/releasenotes.rst @@ -3,6 +3,12 @@ Release Notes This page lists the changes made in each point version of gpkit. +Version 0.6.0 +============= + * new much faster NomialMap data structure (#682) + * Many bug fixes and small improvements. + * 6900 lines of code, 2200 lines of tests, 2100 lines of docstring. + Version 0.5.3 ============= * faster SP solves (#1109) diff --git a/gpkit/__init__.py b/gpkit/__init__.py index e822268d1..8476c1249 100644 --- a/gpkit/__init__.py +++ b/gpkit/__init__.py @@ -19,7 +19,7 @@ from os.path import dirname as os_path_dirname SETTINGS_PATH = os_sep.join([os_path_dirname(__file__), "env", "settings"]) -__version__ = "0.5.3" +__version__ = "0.6.0" UNIT_REGISTRY = None SIGNOMIALS_ENABLED = False GPBLU = "#59ade4" diff --git a/gpkit/constraints/gp.py b/gpkit/constraints/gp.py index 2a258e2c1..434f202f9 100644 --- a/gpkit/constraints/gp.py +++ b/gpkit/constraints/gp.py @@ -218,7 +218,7 @@ def _get_solver(solver): nu=solver_out["nu"], la=solver_out["la"]) except RuntimeWarning as e: if warn_on_check: - print "Solution check warning:", str(e) + print("Solution check warning: %s" % e) else: raise e if verbosity > 1: diff --git a/gpkit/constraints/model.py b/gpkit/constraints/model.py index 7ce80343e..d1dcd0636 100644 --- a/gpkit/constraints/model.py +++ b/gpkit/constraints/model.py @@ -151,8 +151,8 @@ def debug(self, solver=None, verbosity=1, **solveargs): solveargs["solver"] = solver solveargs["verbosity"] = verbosity - 1 - print "< DEBUGGING >" - print "> Trying with bounded variables and relaxed constants:" + print("< DEBUGGING >") + print("> Trying with bounded variables and relaxed constants:") if self.substitutions: constsrelaxed = ConstantsRelaxed(Bounded(self)) @@ -183,10 +183,10 @@ def debug(self, solver=None, verbosity=1, **solveargs): % (orig, mag(self.substitutions[orig]), mag(sol(orig)))) print - print ">> Success!" + print(">> Success!") except (ValueError, RuntimeWarning): print(">> Failure.") - print "> Trying with relaxed constraints:" + print("> Trying with relaxed constraints:") try: constrsrelaxed = ConstraintsRelaxed(self) @@ -207,7 +207,7 @@ def debug(self, solver=None, verbosity=1, **solveargs): " to %s <= %.4g" % (i, relax_percent, constraint.right, constraint.right, relaxval)) - print "\n>> Success!" + print("\n>> Success!") except (ValueError, RuntimeWarning): print(">> Failure") print diff --git a/gpkit/small_classes.py b/gpkit/small_classes.py index 94d0d085c..1b595060b 100644 --- a/gpkit/small_classes.py +++ b/gpkit/small_classes.py @@ -1,5 +1,4 @@ """Miscellaneous small classes""" -from collections import namedtuple from operator import xor import numpy as np from . import ureg @@ -12,7 +11,6 @@ Quantity = ureg.Quantity Numbers = (int, float, np.number, Quantity) -CootMatrixTuple = namedtuple('CootMatrix', ['row', 'col', 'data']) class Count(object): @@ -36,16 +34,17 @@ def to_(self): # used in tocoo, tocsc, etc below return to_ -class CootMatrix(CootMatrixTuple): +class CootMatrix(object): "A very simple sparse matrix representation." - def __init__(self, *args, **kwargs): - # pylint:disable=non-parent-init-called - # pylint:disable=super-init-not-called - # TODO these pylint disables go away with removal of namedtuple - CootMatrixTuple.__init__(self, *args, **kwargs) + def __init__(self, row, col, data): + self.row, self.col, self.data = row, col, data self.shape = [(max(self.row) + 1) if self.row else 0, (max(self.col) + 1) if self.col else 0] + def __eq__(self, other): + return (self.row == other.row and self.col == other.col + and self.data == other.data and self.shape == other.shape) + def append(self, row, col, data): "Appends entry to matrix." if row < 0 or col < 0: @@ -207,7 +206,7 @@ def copy(self): def __hash__(self): "Allows HashVectors to be used as dictionary keys." - # pylint:disable=access-member-before-definition, attribute-defined-outside-init + # pylint:disable=access-member-before-definition, attribute-defined-outside-init if not hasattr(self, "_hashvalue") or self._hashvalue is None: self._hashvalue = reduce(xor, map(hash, self.items()), 0) return self._hashvalue diff --git a/gpkit/solution_array.py b/gpkit/solution_array.py index bb9e65622..507675768 100644 --- a/gpkit/solution_array.py +++ b/gpkit/solution_array.py @@ -197,7 +197,7 @@ def table(self, showvars=(), def plot(self, posys=None, axes=None): "Plots a sweep for each posy" if len(self["sweepvariables"]) != 1: - print "SolutionArray.plot only supports 1-dimensional sweeps" + print("SolutionArray.plot only supports 1-dimensional sweeps") if not hasattr(posys, "__len__"): posys = [posys] for i, posy in enumerate(posys): diff --git a/gpkit/tools/autosweep.py b/gpkit/tools/autosweep.py index 97e098d9b..55c2e96d6 100644 --- a/gpkit/tools/autosweep.py +++ b/gpkit/tools/autosweep.py @@ -233,8 +233,8 @@ def autosweep_1d(model, logtol, sweepvar, bounds, **solvekwargs): tol = recurse_splits(model, bst, sweepvar, logtol, solvekwargs, sols) bst.nsols = sols() # pylint: disable=attribute-defined-outside-init if solvekwargs["verbosity"] > -1: - print "Solved after %2i passes, cost logtol +/-%.3g" % (bst.nsols, tol) - print "Autosweeping took %.3g seconds." % (time() - start_time) + print("Solved in %2i passes, cost logtol +/-%.3g" % (bst.nsols, tol)) + print("Autosweeping took %.3g seconds." % (time() - start_time)) if original_val: model.substitutions[sweepvar] = original_val else: diff --git a/nomenclature.py b/nomenclature.py deleted file mode 100644 index 7fe58f1c3..000000000 --- a/nomenclature.py +++ /dev/null @@ -1,35 +0,0 @@ -from gpkit import Model, parse_variables, Variable -import numpy as np - - -class Fuselage(Model): - """The thing that carries the fuel, engine, and payload - - Variables - --------- - f [-] Fineness - g 9.81 [m/s^2] Standard gravity - k [-] Form factor - l [ft] Length - mfac 2.0 [-] Weight margin factor - R [ft] Radius - rhocfrp 1.6 [g/cm^3] Density of CFRP - rhofuel 6.01 [lbf/gallon] Density of 100LL fuel - S [ft^2] Wetted area - t 0.024 [in] Minimum skin thickness - Vol [ft^3] Volume - W [lbf] Weight - """ - - def setup(self, Wfueltot): - exec parse_variables(self.__doc__) - return [ - f == l/R/2, - k >= 1 + 60/f**3 + f/400, - 3*(S/np.pi)**1.6075 >= 2*(l*R*2)**1.6075 + (2*R)**(2*1.6075), - Vol <= 4*np.pi/3*(l/2)*R**2, - Vol >= Wfueltot/rhofuel, - W/mfac >= S*rhocfrp*t*g, - ] - -print Fuselage(Variable("Wfueltot", 5, "lbf")) diff --git a/setup.py b/setup.py index 7376ec81e..3797858e8 100644 --- a/setup.py +++ b/setup.py @@ -53,7 +53,7 @@ author_email="gpkit@mit.edu", url="https://www.github.com/convexengineering/gpkit", install_requires=["numpy >= 1.8.1", "pint", "scipy"], - version="0.5.3.0", + version="0.6.0.0", packages=["gpkit", "gpkit._mosek", "gpkit.tests", "gpkit.interactive", "gpkit.nomials", "gpkit.constraints", "gpkit.tools"], package_data={"gpkit": ["pint/*", "env/*"],