Code Monkey home page Code Monkey logo

jumptutorials.jl's Introduction

Update: April 2021: The JuMPTutorials.jl repository is archived and will not be maintained. The tutorials from this repository have been moved to the JuMP documentation.

JuMPTutorials.jl

Powered by NumFOCUS Build Status

This repository contains tutorials on JuMP, a domain-specific modeling language for mathematical optimization embedded in Julia. Tutorials can be viewed in the form of webpages, and interactive Jupyter notebooks. This set of tutorials is made to complement the documentation by providing practical examples of the concepts. For more details, please consult the JuMP documentation.

These tutorials are currently under development as a part of a Google Summer of Code project. The current list of tutorials that are planned can be viewed at the following issue. If there is a tutorial you would like to request, please add a comment to the above issue. Any other suggestions are welcome as well.

There are also some older notebooks available at juliaopt-notebooks repository. Most of these were built using prior versions of JuMP and may not function correctly, but they can assist in implementing some concepts. There are also some code examples available in the main JuMP repo.

Run Notebooks in the Browser

Binder

To try out any of the tutorials in the browser without downloading Julia, click on the launch binder button above. Note that this functionality only supports open-source solvers which do not have additional requirements (for e.g. BLAS or MATLAB). This is also very slow and can take several minutes to start as it has to first install Julia and all the dependencies. Thus, you should download and run the notebooks on your PC for the best experience.

Table of Contents

jumptutorials.jl's People

Contributors

amontoison avatar barpit20 avatar frapac avatar github-actions[bot] avatar kreibaum avatar matbesancon avatar mlubin avatar mtanneau avatar mthelm85 avatar odow avatar

Stargazers

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

Watchers

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

jumptutorials.jl's Issues

Add Figures

The following notebooks could benefit from figures being added. They can be images or plots generated from within Julia.

  • Network Flows
  • Geometric Problems

Changes in MIP notebook

Put semiinteger and semicontinuos contraints to the botton. Same for SOS.

Bring logical conditionals and disjunctions should go up.

Clean up test folder

Most of the files there are the same as the scripts. The only difference is that comments are removed.
Comments are not executed anyway... we should just run the script folder.

Roadmap for JuMPTutorials

Hi,
I am opening this issue to sum up a few discussions we had during the JuMP dev calls. I would like to know what are the current plans concerning :

  • the automatic generation of the files in notebooks/ in travis
  • the status of JuMPTutorials w.r.t. JuMP: do we still plan on merging JuMPTutorials in the JuMP repo?
  • also, is there any plan to generate a HTML version of the tutorials, to include them directly in the JuMP's website (e.g. in a cvxpy fashion)?

Again, this issue is just to port the discussion in an asynchronous place, and I would be happy to help on improving JuMPTutorials.

Explain how to install dependencies with conda

Could you please add a little information to help new Julia users to get set up for the JuMPTutorials.jl in the README?

I installed Julia via Homebrew and installed JuMP and a few solvers via the Julia Pkg manager, and it worked. Then I installed IJulia and for a short time it worked, I could start a Julia notebook from the launcher after jupyter lab.

Then I tried to get the JuMPTutorials.jl to run, and ran this command from your .travis.yml:

julia --project=docs/ -e 'using Pkg; Pkg.instantiate(); Pkg.develop(PackageSpec(path=pwd()))'

Now I'm in deep trouble, I get errors like this when I try to start jupyter lab:

ERROR: LoadError: Failed to precompile IJulia

See https://gist.github.com/cdeil/020d25045b6b4ca4dd67b53426b782b3

I'm experienced with Python and conda, but I'm completely new to Julia, don't know about Julia environments or Project.toml and Manifest.toml or how those interact with my conda environments. Would appreciate a tip how to remove the broken env / install. But my main feature request here is some docs in the README what the "good" or "normal" way to get set up for the Jump tutorials locally is.

Status of tests

What are we doing currently?

Should we run the scripts themselves?

I have seen we have specific files for tests, are they automatically generated?

Power Systems Modeling Example

For the Unit Commitment Model, one of the current constraint reads:

@constraint(uc, [i = 1:2], g[i] <= g_max[i]) #maximum
@constraint(uc, [i = 1:2], g[i] >= g_min[i]) #minimum

it should instead be:

@constraint(uc, [i=1:2], g[i] <= g_max[i] * u[i])
@constraint(uc, [i=1:2], g[i] >= g_min[i] * u[i])

The u variable is the binary unit commitment controller for the optimization. It is declared but not utilized in the example.

Run Notebooks in the Browser

We need to explore services such as Binder and Google Colab to enable people to try out the tutorials in the browser itself without having to download anything.

Add Helpful Links

Benders Decomposition

We can add links such as:

  • one explaining other relevant definitions and the high-level benders algorithm mathematically
  • issue/pr related to the status of callbacks

Add Citations

Switching to pandoc from Julia markdown will enable usage of citations in Weave 0.4.1

Consistency check

It would be nice if there was a CI check that the notebooks correspond to the script files that are checked in. It could be easy to forget to regenerate a notebook when modifying a script.

Change from `convert_doc` to `notebook`

As of Weave 0.5.1. there is a new notebook method to convert Weave documents to Jupyter notebooks using nbconvert. It runs all the code blocks in the notebook which is better for us.

Broken CI on master + Julia1.5

Just for tracking.

The failure is only on Julia 1.5 at this point, and seems to come from the Weave module.
The error message is

ERROR: LoadError: InitError: Evaluation into the closed module `Markdown` breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating `Markdown` with `eval` during precompilation - don't do this.

Automation status

Is it possible to generate files with travis or something similar?

Tests

Very cool! This is going to be a great resource.

Just a query re the tests. It seems like the tests run all of the code in the notebooks, but I couldn't find any checks using @test that the output is what we expect. Is there a way to add some tests? Or is it sufficient to just run the code and check that it doesn't error?

Add semicolons

Add semicolons at the end of code blocks where we want to suppress output

MLE example in nonlinear_modelling.ipynb broken?

Currently in nonlinear_modelling.ipynb for the MLE example I see this result:

μ = 0.0
mean(data) = -0.02534297022835935
σ^2 = 1.0
var(data) = 1.0112373171501061
MLE objective: -0.0

Is mu=0 and objective=0 a bug? Shouldn't mu match mean?

I have IJulia install issues, can't get the notebook to run unfortunately to investigate.

Make LaTeX consistent

I have used a few different ways to write the models in the math mode i.e. spacing differs between some notebooks. This isn't really high priority though.

Notebooks to Implement

  1. Introduction
  • An Introduction to Julia
  • Getting started with JuMP
  • Variables, Constraints and Objective
  • Solutions
  • Solvers
  1. Using JuMP
  • Reading from Data files
  • Problem Modification
  • Nonlinear Modeling
  1. Optimization Concepts
  • Integer Programming
  • Conic Programming
  • Benders Decomposition
  1. Modeling Examples (Currently a list of topics to pick examples from)
  • Sudoku
  • Power Systems
  • Network Flows
  • Statistics
  • Approximation and Fitting
  • Geometric Problems
  • Control theory
  • Graph Theory
  • Economics/Econometrics
  • Finance
  • Rocket Control
  • Travelling Salesman Problem

Note that this is a tentative list and some notebooks can be combined or split into two parts. Topics such as non-linear modelling, callbacks and column generation are ongoing dev efforts. Things are subject to change there and notebooks for them will only be created after they are finalized.

notebook and section title sizes and repetitiveness

In the Jupyter notebook renderings at least, the notebook title is the same size as the subsection titles. It would be nice if the notebook title was more clearly distinguished by size. Can the section and subsection titles be made smaller?

There is also some repetitiveness between section titles, and in some cases I think some notebooks have more sections/subsections than is needed. eg in https://nbviewer.jupyter.org/github/barpit20/JuMPTutorials.jl/blob/master/notebook/modelling/experiment_design.ipynb

The Benders notebook has errors

https://nbviewer.jupyter.org/github/JuliaOpt/JuMPTutorials.jl/blob/master/notebook/optimization_concepts/benders_decomposition.ipynb

┌ Info: Precompiling JuMP [4076af6c-e467-56ae-b986-b466b2749572]
└ @ Base loading.jl:1192
ERROR: LoadError: ArgumentError: Package MutableArithmetics [d8a4904e-b15c-11e9-3269-09a3773c0cb0] is required but does not seem to be installed:
 - Run `Pkg.instantiate()` to install all recorded dependencies.

Stacktrace:
 [1] _require(::Base.PkgId) at ./loading.jl:929
 [2] require(::Base.PkgId) at ./loading.jl:858
 [3] require(::Module, ::Symbol) at ./loading.jl:853
 [4] include at ./boot.jl:317 [inlined]
 [5] include_relative(::Module, ::String) at ./loading.jl:1044
 [6] include(::Module, ::String) at ./sysimg.jl:29
 [7] top-level scope at none:2
 [8] eval at ./boot.jl:319 [inlined]
 [9] eval(::Expr) at ./client.jl:393
 [10] top-level scope at ./none:3
in expression starting at /home/mbesancon/.julia/packages/JuMP/CZ8vV/src/JuMP.jl:16

Exponential cone for entropy example is wrong

First thank a lot for putting these examples together!

The entropy maximization example under "Conic Programming" contains a bug. The correct exponential cone for this example is
(t,x,1)∈Kexp
instead of
(1,x,t)∈Kexp .

Hence the constraint should be

@constraint(model, con[i = 1:n], [t[i]], x[i], 1] in MOI.ExponentialCone())

Path issue on using Weave

When using Weave to convert a tutorial which reads from another data file, Weave uses the path of the current directory instead of the path of the file being weaved. This throws an error that the file cannot be found.

remove misc files?

since this isn't really a Julia "package", but rather a repo for tutorials, would it make sense to reduce clutter and remove src and test folders and other unnecessary files that were autogenerated?

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.