Code Monkey home page Code Monkey logo

golp's Introduction

MILP Solver for Go

TODO List

[x] basic wrapper for large problem

[ ] custom cbc-solver commandline

[ ] other solver not only CBCSolver

[ ] high-level API calculate complex operators like ()

Usage

cbc := &CBCSolver{cbcPath: "/usr/local/bin/cbc"}
p := NewProblem("a")
x1 := p.NewNormalVar("x1", 0, 40)
x2 := p.NewNormalVar("x2", math.Inf(-1), math.Inf(1))
x3 := p.NewNormalVar("x3", math.Inf(-1), math.Inf(1))
x4 := p.NewIntegerVar("x4", 2, 3)
p.SetObj(NewObjBuilder().Add(1, x1).Add(1, x2).Add(3, x3).Add(1, x4).Maximize())
p.AddST(NewSTBuilder("c1").Add(-1, x1).Add(1, x2).Add(1, x3).Add(10, x4).Leq().AddConst(40).Done())
p.AddST(NewSTBuilder("c2").Add(1, x1).Add(-3, x2).Add(1, x3).Leq().AddConst(30).Done())
p.AddST(NewSTBuilder("c3").Add(1, x2).Add(-3.5, x4).Eq().AddConst(0).Done())

err := p.Solve(cbc)
if err != nil {
    panic(err)
}
fmt.Println(x1.getVal()) // get the val of variable x1

golp's People

Watchers

James Cloos avatar InsZVA avatar

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.