GithubHelp home page GithubHelp logo

acco32 / operations-research Goto Github PK

View Code? Open in Web Editor NEW
12.0 2.0 1.0 2.39 MB

Operations Research in F#

Home Page: https://acco32.github.io/Operations-Research/

License: MIT License

F# 99.85% Shell 0.15%
operations-research fsharp ortools mathematics solver constraints

operations-research's Introduction

F#OR (Operations Research with F#)

Operations Research
LICENCE

Library to solve operations research problems in F#. You can specify your objective and constraints and then use one of the underlying solvers to get an answer. Currently the only solver used is Google’s OrTools.

Solver Types

  • Linear Programming (Google MIP/LP)

  • Constraint Programming (Google CP-SAT)

  • Routing (Google Route API)

Example

open System
open Operations.Research.Types
open Operations.Research.Models
open Operations.Research.Solvers.Google.Linear

let x = Variable.real "x" 0.0 Double.PositiveInfinity |> toExpression
let y = Variable.real "y" 0.0 Double.PositiveInfinity |> toExpression


let mdl =
  Model.Default
  |> DecisionVars [x; y]
  |> Goal Maximize
  |> Objective  (6*x + 2*y + 77)
  |> Constraints [
    3*x + 1*y <== 48
    3*x + 4*y <== 120
    3*x + 1*y >== 36
  ]

let result = SolveWithCustomOptions mdl SolverOptions.Default

match result with
| Solution sol ->
    printfn "Objective: %i" (sol.Objective.toInt)
    printfn "%s: %i" "x" (sol.Variables.["x"])
    printfn "%s: %i" "y" (sol.Variables.["y"])
| Error e ->
    printfn "%A" e

Install necessary tools

Run the script to install-task-runner.sh to install tusk. This will install the tool nessary for building the application. Then run the tool to view the task options.

./tools/tusk

operations-research's People

Contributors

acco32 avatar

Stargazers

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

Watchers

 avatar  avatar

Forkers

azagniotov

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.