Giter Site home page Giter Site logo

optiframe's Introduction

Optiframe PyPI Version License

Optiframe is an optimization framework for writing mixed integer programs (MIPs).

It allows you to structure your MIPs in a way that allows clear separation of concerns, high modularity and testability.

Core Concepts

  • The optimization process is divided into multiple steps which are clearly separated:
    1. Validation allows you to validate the input data.
    2. Pre-processing allows you to optimize the provided data to reduce the size of the final model.
    3. MIP building allows you to modify the MIP to define the optimization problem.
    4. Solving is a pre-defined step that obtains an optimal solution for the problem.
    5. Solution extraction allows you to process the variable values of the solution into something more meaningful.
  • Tasks are the core components that allow you to implement functionality for each step.
    • The constructor of a task allows you to define dependencies for that task, which are automatically injected by the optimizer based on their type annotation.
    • The execute method allows you to implement the functionality. It may return data which can then be used by other tasks as a dependency.
  • Modules combine tasks that belong together. Each module must contain a task for building the MIP and can additionally contain tasks for validation, pre-processing and solution extraction. The modules are what makes Optiframe so extendable: You can define extensions of a problem in a separate module and only include it if needed.
  • The optimizer allows you to configure the packages that you need. Afterwards, you can initialize it with the instance data and then solve the optimization problem.

Installation & Usage

pip install optiframe

Take a look at the examples folder for examples on how to use Optiframe!

License

This project is available under the terms of the MIT license.

optiframe's People

Contributors

timjentzsch avatar

Stargazers

Abdalrahman Saqr avatar David Alexander avatar Mathias Fischler avatar

Watchers

 avatar

optiframe's Issues

Add pre-processing step

Add a step which allows the user to apply pre-processing to the data.
This enables optimization opportunities to reduce the number of variables and constraints in the final model, reducing the solution time.

Add convenience `.solve(...)` method to `InitializedOptimizer`

Often, you don't want to execute each step in separation, but want to execute all steps at once.
For this, we should provide a convenience .solve() method on the InitializedOptimizer, which behaves like calling .validate().pre_processing().build_mip().solve(...).

Improve solution extraction

It is currently not very ergonomic to extract the final solution after solving the problem.
It would be nice if all relevant objects were packaged together already and ready to access in a convenient way.

Remove objective data injection

The objective is currently available for injection as the LpAffineExpression type.
However, this is a very general type and doesn't clearly reflect that it's an objective.
Furthermore, the objective can also be accessed via LpProblem.objective, saving an additional variable.

Therefore, the objective should not be made available explicitly and instead be accessed through the LpProblem.

Add README description

Add a README with at least the following content:

  • The name and a short description of the project
  • Installation and usage instructions
  • Licensing information

Add utility methods to get total solve time and model size

This is for example useful for benchmarks.

The StepTimes class should provide means to get the total time (sum of all optimization times).
The ModelSize class should provide means to get the total model size (variable count times constraint count).

Add badges to README

Add badges to the README file to display the current PyPI version and the license.

Add detailed example

Add an example project showcasing how to use this library.
It should feature at least two packages.

Rename abstract methods of task classes

The task classes for each step should rename the methods that need to be overwritten.
For example, the ValidationTask should have a validate method with corresponding documentation.
The execute method should then just call the new method.

Add metrics to solution

Add some useful metrics to the output of the optimizer:

  • Model size (number of variables & constraints)
  • Times of each step (validation, pre-processing, MIP building, solving, solution extraction)

Deploy documentation

The documentation defined in the source files should be parsed, transformed into pretty HTML docs and then deployed (probably via GitHub pages).

We need to figure out which tooling Python has to accomplish this.

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.