Code Monkey home page Code Monkey logo

rcognita's People

Contributors

ebolotin6 avatar kefir8888 avatar kompaso avatar osinenkop avatar yaremenko8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rcognita's Issues

Inline RST documentation does not follow conventional practices. Info field lists should be utilized.

A great deal of code is currently documented in an unconventional fashion. To be more precise, there seems to be a tendency to use headings to describe attributes, parameters and returned values, as opposed using info field lists.

For instance consider the docstring for rcognita.controllers.ctrl_selector:

    Main interface for various controllers.
        Parameters
        ----------
        mode : : string
            Controller mode as acronym of the respective control method.
        Returns
        -------
        action : : array of shape ``[dim_input, ]``.
            Control action.

The conventional way to produce a docstring bearing such information would be:

    Main interface for various controllers.

    :param str mode: Controller mode as acronym of the respective control method.
    :return: Control action
    :rtype: array of shape ``[dim_input, ]``

Tests framework implementation

Here are some requirements for implementation of Rcognita framework for tests.

  • A framework should be easy-to-use

  • It should be provided with comprehensive and clear instructions on how to create tests using this framework

  • It should cover all currently implemented presets

  • It should prevent code duplication

  • There should be an out-of-the-box possibility to generate a reference data for unit-tests

Fix animation

Fix simulation animation to work in default Python interpreter instead of only ipython

Constructor arguments recorded as "attributes" in class docstrings.

__init__ should have a docstring of its own. The "Attributes" section in class dosctrings is reserved for attributes. Violating this convention really messes up the wiki. We should fix that (preferably by next release I think) and from now on proceed to document new classes conventionally.

Multiple modifications

Code cleaning and refactoring needed for the modifications done throughout Q1, Q2 of 2021, including those done for education.

This concerns:

  • actor constraints
  • new methods: JAC-stab, SQL, SQL-stab, SQL-V etc.
  • critic constraints for the respective methods, e.g., JAC-stab, SQL-stab etc.
  • new systems
  • generic main module (make to a class)
  • model estimation
  • loggers
  • ROS integration

and so on

Add parsing of command line arguments in presets

We need a call capability like:

python main_3wrobot_NI.py -ctrl_mode JACS -dt 0.01 ...

Required parameters:

Parameter name Values Notes
ctrl_mode string see description of methods in preset
dt number controller sampling time
t1 number final time
x0 numpy vector initial state, dimension preset-specific!

Optional parameters, set to default values unless specified otherwise:

Parameter name Values Default Description
is_log_data binary 0
is_visualization binary 1
is_print_sim_step binary 1
is_est_model binary 0 if a model of the env. is to be estimated online
model_est_stage number 1 seconds to learn model until benchmarking controller kicks in
model_est_period number 1*dt model is updated every model_est_period seconds
model_order integer 5 order of state-space estimation model
prob_noise_pow number 8 power of probing noise
uMan numpy vector zeros manual control action to be fed constant, system-specific!
Nactor integer 3 horizon length (in steps) for predictive controllers
pred_step_size number dt
buffer_size integer 10
rcost_struct string quadratic structure of running cost function
R1 numpy matrix identity matrix must have proper dimension
R2 numpy matrix identity matrix must have proper dimension
Ncritic integer 4 critic stack size (number of TDs)
gamma number 1 discount factor
critic_period number dt critic is updated every critic_period seconds
critic_struct string quad-nomix structure of critic features
actor_struct string quad-nomix structure of actor features

This needs to be reflected in the readme, as an example call of an example present. Could probably be translated from this text.

ROS harnesses

Create a ROS_harnesses.py module to separate a ROS preset and a ROS setting utility

NN model

  • Make an NN model
  • Make a torch optimizer for NN model

Disturbance dynamics

Right now, the full state vector in the closed loop function of the system interface contain components related to the disturbance, even if the latter is switched off. Need case distinction as:

  1. is_disturb => dim_full_state = dim_state + dim_disturb
  2. not is_disturb => dim_full_state = dim_state

Architecture refactoring

  • no switch cases inside classes, only on pipeline or configuration level
  • self.critic_clock into Critic class and, in general, all class-related field put in classes (with corresp. renaming)

trust-constr clean up

@osinenkop
Is it possible to move it

critic_opt_method = 'SLSQP'
if critic_opt_method == 'trust-constr':
critic_opt_options = {'maxiter': 200, 'disp': False} #'disp': True, 'verbose': 2}
else:
critic_opt_options = {'maxiter': 200, 'maxfev': 1500, 'disp': False, 'adaptive': True, 'xatol': 1e-7, 'fatol': 1e-7} # 'disp': True, 'verbose': 2}

outside the module?

Environment configuration is very inconvenient

The solution here is a class which has the following structure:

class abstract_config:
    def __init__(self):
        self.name = "some_agent"
    def argument_parser(self):
        pass
    def post_processing(self):
        pass
    def get_env(self):
        pass

It's very intuitive separation of command-line arguments and other arguments together with their post-processing.

CASADI integration

  • Completely refactor the code: separate the symbolic case and numerical case and move the code out of the controller.py
  • Create tests for CASADI integration
  • Make some benchmarks and create a table of comparison

Refactor presets in a pipeline style

There were currently implemented a framework for testing and reference data generation. To make it possible to test preset and improve readability of the code all presets were implemented using pipeline approach that appeared to be a good pattern for implementation of presets. To transfer Rcognita to the new preset implementation pattern, it is necessary to:

  • Implement a CLI-interface consistent with the pipeline
  • Refactor and implement pipelines for all presets

Implement Monte-Carlo method and pipeline

Need:

  1. System: pendulum
  2. Scenario for Monte-Carlo learning
  3. REINFORCE

Visualizer: as always (like 3wrobot), but upper left screen: pendulum and its trajectory (dotted line like 3wrobot)

Monte-Carlo scenario:

  1. loop over policy gradient updates
  2. each such update needs several episodes (former runs), so loop over episodes
  3. each episode is like the current main loop, i.e., it iterates over steps
  4. when all episodes are done, experience is used to update policy parameters

Policy must be a PDF (probability distro func). Useful policy parametrizations -- see S&B, p. 322 book.
REINFORCE algorithm can also be found there

Sort old data

Check everything for correctness and necessity.
Split into different readable folders.
All data on kompaso's ssd.

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.