Giter Site home page Giter Site logo

Comments (2)

ojdo avatar ojdo commented on June 15, 2024

Inventory

Kind of obvious (in hindsight): simply call get_entity once for each model entity returned by a call to list_entities for each of the entity types set, parameter, variable, objective, constraint. Using this, no manual maintenance is required and all possibly interesting information is preserved.

Serialization format

Pandas supports HDF5 by relying on the PyTables package.

Internal result representation

A (possibly nested) dictionary of pandas Series:

result = {
    'set': { 't': <Series>, 'tm': <Series>, 'com': <Series>, ... },
    'par': { 'w': <Series>, ... },
    'var': { ... },
    'obj': { ... },
    'con': { ... }}

Alternative: a nested AttrDict for easier access like result.var.e_pro_out.

Further thoughts

The choice of representation has ripple effects concerning functions get_timeseries and get_constants, which should switch to relying on the result representation that gets automatically updated by a solver run. This in turn calls for creating a custom class (urbs, maybe?) that bundles this new behaviour. Then, an urbs object could either be created in its solved state by reading input + solving, or by directly loading a HDFStore file, populating the internal result data structure. Additional meta information (time stamps, scenario descriptions, notes) could transparently be added.

from urbs.

ojdo avatar ojdo commented on June 15, 2024

Update on internal result representation: the dictionary probably should not be nested by entity type, to make the logic of function get_entity simpler, like:

def get_entity(instance, name):
    if name in instance._result:
        return instance._result[name]
    else:
        raise SomeException

The hidden _result field should get populated automatically after a successful solver run. Perhaps, the output of list_entities (entity name, type and domain) could be stored where?

from urbs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.