GithubHelp home page GithubHelp logo

Precision of floats in lp files about linopy HOT 5 CLOSED

pypsa avatar pypsa commented on June 3, 2024
Precision of floats in lp files

from linopy.

Comments (5)

FabianHofmann avatar FabianHofmann commented on June 3, 2024

Hey @jafluri, thanks for pointing this out. Correct me, if I am wrong, but the default precision seems to be 6. Since we do not want to bloat the LP file size, could you try out whether a precision of 8/9 is already satisfying?

from linopy.

jafluri avatar jafluri commented on June 3, 2024

Thanks for the quick reply. I just ran the model for 6, 9, 12 and 15 significant digits. The objective for 9, 12 and 15 is identical. Comparing the variable values to the ones from pyomo, you get the smallest differences with 12 and 15, but I guess 9 should be enough as some floating point jitter is to be expected in large models.

from linopy.

jafluri avatar jafluri commented on June 3, 2024

In combination with #112, one could do "%+.12g", that strips away the tailing zeros:

array([1. , 1.2 , 1.2334567]) -> array(['+1', '+1.2', '+1.2334567'], dtype=object)

I'd assume that way you'd safe memory in most cases, even if you go up to 12, compared to the current implementation.

from linopy.

FabianHofmann avatar FabianHofmann commented on June 3, 2024

Oh, this sounds great! Could you do a PR?

from linopy.

jafluri avatar jafluri commented on June 3, 2024

Thanks for the quick resolution, I'm closing this then.

from linopy.

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.