Giter Club home page Giter Club logo

rgolubtsov / nonlinear-optimization-algorithms-multilang Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 6.0 476 KB

Nonlinear programming algorithms as the (un-)constrained minimization problems with the focus on their numerical expression using various programming languages.

License: The Unlicense

Makefile 17.87% Java 5.57% C 21.98% C++ 7.93% Fortran 11.49% Objective-C 7.54% JavaScript 5.77% Perl 5.58% Go 5.63% Python 5.91% Vala 4.74%
nonlinear-programming-algorithms multilang c cplusplus fortran golang java javascript objective-c perl python vala cli nodejs

nonlinear-optimization-algorithms-multilang's Introduction

Nonlinear Optimization Algorithms Multilang Build Status

The following implementations are on the workbench (:small_blue_diamond: – complete, :small_orange_diamond: – planned/postponed, :cd: – in progress):

  • The Hooke and Jeeves (original) 🔹 Traditional (K&R) C: nlp-unconstrained-cli/hooke-jeeves/__orig/
  • The Hooke and Jeeves 🔹 ISO C (C99): nlp-unconstrained-cli/hooke-jeeves/c/
  • The Hooke and Jeeves 🔹 ISO C++ (C++98): nlp-unconstrained-cli/hooke-jeeves/cc/
  • The Hooke and Jeeves 🔹 Objective-C 2.0: nlp-unconstrained-cli/hooke-jeeves/objc/
  • The Hooke and Jeeves 🔹 FORTRAN 77 (MIL-STD 1753): nlp-unconstrained-cli/hooke-jeeves/f77/
  • The Hooke and Jeeves 🔹 ISO Fortran 95: nlp-unconstrained-cli/hooke-jeeves/f95/
  • The Hooke and Jeeves 🔹 Perl 5 (5.10+): nlp-unconstrained-cli/hooke-jeeves/perl/
  • The Hooke and Jeeves 🔹 JavaScript (ECMA-262 5.1): nlp-unconstrained-cli/hooke-jeeves/js/
  • The Hooke and Jeeves 🔹 Java (Java SE 7): nlp-unconstrained-cli/hooke-jeeves/java/
  • The Hooke and Jeeves 🔹 Go: nlp-unconstrained-cli/hooke-jeeves/go/
  • The Hooke and Jeeves 🔹 Python 2 & 3: nlp-unconstrained-cli/hooke-jeeves/python/
  • The Hooke and Jeeves 🔹 Vala: nlp-unconstrained-cli/hooke-jeeves/vala/

  • The Nelder-Mead (original) 🔹 FORTRAN 77 (MIL-STD 1753): nlp-unconstrained-cli/nelder-mead/__orig/
  • The Nelder-Mead 🔹 ISO C (C99): nlp-unconstrained-cli/nelder-mead/c/

This project is aimed at implementing nonlinear programming algorithms as the (un-)constrained minimization problems with the focus on their numerical expression using various programming languages.

The idea behind is to collect some of nonlinear programming (NLP) algorithms/methods which are well known and developed, and when they have low or moderate level of complexity during their coding in programming languages in an analytical form. Furthermore, such NLP-algorithms will have to be applied to one or more test problems in numerical expression, and then the user will be able to get solutions for those problems and watch the digits.

All of these algorithms should be coded in a series of programming languages. Not every subsequent selected algorithm must be implemented in every particular language chosen for the previous one, but in some of them (the standard C is an exception) which are widely used nowadays. The main requirement here is the resulting output containing the solution for any kind of test problem must be the same for all implementations. I.e. output blocks made after computations produced by the C code, Java code, Fortran code and so on should be identically equal each other with respect to computed precision, precision expression, layout and spacing emitted to standard out (or user console).

Consider this project as a somewhat educational approach to the subject of implementing math algorithms in programming languages rather than it might be considered otherwise as bringing something important to scientific applications and investigations.

Why NLP-algorithms, exactly? – The answer is why not? Indeed, NLP optimization methods and techniques are widely used everywhere. Their complexity ranges are quite different. They are suitable and fit the most optimization models more precisely and accurately than their linear optimization counterparts. – That's why.

There are two main conventional groups of NLP optimization methods: constrained and unconstrained. In this project it is considered to be implemented first two unconstrained minimization methods: (1) The algorithm of Hooke and Jeeves and (2) The Nelder-Mead algorithm.

Overview

The project has the following directory structure and logical parts and items.

.
|-- nlp-unconstrained-cli              <== Unconstrained methods impl. container
|   |                                      (including test problems)
|   |-- hooke-jeeves                   <== Hooke-Jeeves algorithm container
|   |   |                                  (all implementations)
|   |   |-- c                          <== ISO C (C99/11) impl. container
|   |   |   |-- Makefile
|   |   |   `-- src
|   |   |       |-- <sources>
|   |   |       `-- Makefile
|   |   |
|   |   |-- cc                         <== ISO C++ (C++98/03/11/14) impl. container
|   |   |   |-- Makefile
|   |   |   `-- src
|   |   |       |-- <sources>
|   |   |       `-- Makefile
|   |   |
|   |   |-- f77                        <== FORTRAN 77 (MIL-STD 1753) impl. container
|   |   |   |-- Makefile
|   |   |   `-- src
|   |   |       |-- <sources>
|   |   |       `-- Makefile
|   |   |
|   |   |-- f95                        <== ISO Fortran 95 impl. container
|   |   |   |-- Makefile
|   |   |   `-- src
|   |   |       |-- <sources>
|   |   |       `-- Makefile
|   |   |
|   |   |-- go                         <== Go (golang) impl. container
|   |   |   |-- Makefile
|   |   |   `-- src
|   |   |       |-- <sources>
|   |   |       `-- Makefile
|   |   |
|   |   |-- java                       <== Java (Java SE 7) impl. container
|   |   |   |-- Makefile
|   |   |   |-- pom.xml
|   |   |   `-- src
|   |   |       `-- main
|   |   |           `-- java
|   |   |               `-- optimization
|   |   |                   `-- nonlinear
|   |   |                       `-- unconstrained
|   |   |                           `-- cli
|   |   |                               `-- <sources>
|   |   |
|   |   |-- js                         <== JavaScript (ECMA-262 5.1) impl. container
|   |   |   |-- Makefile
|   |   |   `-- src
|   |   |       `-- <sources>
|   |   |
|   |   |-- objc                       <== Objective-C 2.0 impl. container
|   |   |   |-- Makefile                   (using the GNUstep Base library)
|   |   |   `-- src
|   |   |       |-- <sources>
|   |   |       `-- Makefile
|   |   |
|   |   |-- __orig                     <== Traditional (K&R) C impl. container
|   |   |   |-- Makefile                   (This is the original impl.)
|   |   |   `-- src
|   |   |       |-- <sources>
|   |   |       `-- Makefile
|   |   |
|   |   |-- perl                       <== Perl 5 (5.10+) impl. container
|   |   |   |-- Makefile
|   |   |   `-- src
|   |   |       |-- NLPUCCLIHooke
|   |   |       |   `-- <sources>
|   |   |       `-- <sources>
|   |   |
|   |   |-- python                     <== Python 2 & 3 impl. container
|   |   |   |-- Makefile
|   |   |   `-- src
|   |   |       |-- <sources>
|   |   |       `-- nlpucclihooko
|   |   |           `-- <sources>
|   |   |
|   |   `-- vala                       <== Vala impl. container
|   |       |-- Makefile
|   |       `-- src
|   |           |-- <sources>
|   |           `-- Makefile
|   |
|   `-- nelder-mead                    <== Nelder-Mead algorithm container
|       |                                  (all implementations)
|       |-- c                          <== ISO C (C99/11) impl. container
|       |   |-- Makefile
|       |   `-- src
|       |       |-- <sources>
|       |       `-- Makefile
|       |
|       `-- __orig                     <== FORTRAN 77 (MIL-STD 1753) impl. container
|           |-- Makefile                   (This is the original impl.)
|           `-- src
|               |-- <sources>
|               `-- Makefile
|
|-- [ nlp-unconstrained-api ]          <== [TODO] Unconstrained methods impl. container
|                                                 (API only)
|-- [ nlp-constrained-cli ]            <== [TODO] Constrained methods impl. container
|                                                 (including test problems)
`-- [ nlp-constrained-api ]            <== [TODO] Constrained methods impl. container
                                                  (API only)

As shown above, the directories that should contain stuff for the Nelder-Mead algorithm implementations as well as other three ones (nlp-unconstrained-api, nlp-constrained-cli, and nlp-constrained-api) are not yet exist. But it's planned they have to be created and populated accordingly somewhen during development process.


TODO: Extend the Overview section and provide other related sections (design, building, running, etc.) just like in this readme doc or whatsoever. 💿

nonlinear-optimization-algorithms-multilang's People

Contributors

rgolubtsov avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nonlinear-optimization-algorithms-multilang's Issues

NLPUC: Nelder-Mead-c: Eliminate jumping through unconditional gotos.

In the struct optimum *nelmin(...) {...} function defined in the nelmin.c source replace unconditional gotos and related blocks with the equivalent structured constructs, helper functions for ex., etc. They are:

L1000:; ...
L2000:; ...
L3000:; ...
L4000:; ...

goto L1000; ...
goto L2000; ...
goto L3000; ...
goto L4000; ...

Some questions / refactoring suggestions

Hi,
Respect for amount of work done on this programs. I try to make something similar in Java, and I got shocked by few things I found in your code.

For first what for do you pass argument "final int n" for functions f in Rosenbrock and Woods as it is not used anywhere.

Secondly why are you passing Rosenbrock and Woods as .class and then checking it in if then else. What if you had 1000 functions you would make 1000 if else blocks ?

You can make abstract class for example "MathFunction" which would have everything that every function that is optimized have in common and then just call its methof "f" or I'd better call it "functionValue" all this if else blocks would be unnnecesary, you will call function you need depending of what MathFunction extending class you will pass...

Best regards,

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.