Git Product home page Git Product logo

Comments (6)

rienq avatar rienq commented on September 26, 2024

I again totally agree, these global counters have been a handicap that is getting only worse also for developing the code, since things start probably only depending on it more and more..
Since I had the issue myself once, I can propose a quick fix if you are interested:
you can reset the counters at the end of your 'code generation code' which turns it into something more or less modular.. ;-)

But in any case, I believe it would be worth it to spend the effort getting rid of these global counters if possible ! What does the rest think?
Maybe it is also better to assign these issues to a certain milestone..

from acado.

mvukov avatar mvukov commented on September 26, 2024

This is an inherent property of AD within ACADO -- I am referring to the static variables. I agree this is not the smartest way to deal with enumerating expressions, and whoever is willing to work on AD within ACADO is welcome.

From what @ghorn says it looks to me that there is an elegant workaround in python.

Bindings are the separate issue, not related to the aforementioned issue. What I would like to see is SWIG in ACADO, something maintainable.

Those can be set as a task for a milestone, and I would close this issue.

from acado.

ghorn avatar ghorn commented on September 26, 2024

I don't fully understand what you changed the name of this issue to. Are DifferentialState / Control / etc. incrementing static counters? Or is this only internal to AD?

from acado.

mvukov avatar mvukov commented on September 26, 2024

@ghorn You can study the class inheritance tree starting from Expression class if you want to understand this matter. Those classes hold static counters. Function like classes use those enumerations.

from acado.

ghorn avatar ghorn commented on September 26, 2024

Hey Rien, can you give me a little code example which shows how to reset the counters?

from acado.

rienq avatar rienq commented on September 26, 2024

sure, it looks like this depending on which ones you want to reset:

Control dummy1; dummy1.clearStaticCounters();
DifferentialState dummy2; dummy2.clearStaticCounters();
Parameter dummy3; dummy3.clearStaticCounters();
IntermediateState dummy4; dummy4.clearStaticCounters();
...

from acado.

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.