Giter VIP home page Giter VIP logo

mo-book-with-ampl's People

Contributors

4er4er4er avatar alessandrozocca avatar fdabrandao avatar glebbelov avatar gomfy avatar gromicho avatar jckantor avatar krzysztofpostek avatar leonlan avatar marcos-dv avatar nfbvs avatar

Watchers

 avatar

Forkers

ampl

mo-book-with-ampl's Issues

Chapter 2 LAD model broke

I am not able to run LAD-regression (chapter 2), it seems that something broke with some amplpy or numpy update.
The model is very simple:

# indexing sets
set I;
set J;

# parameters
param y{I};
param X{I, J};

# variables
var ep{I} >= 0;
var em{I} >= 0;
var m{J} >= 0;
var b;

# constraints
s.t. residuals {i in I}:
    ep[i] - em[i] == y[i] - sum{j in J}(X[i, j] * m[j]) - b;

# objective
minimize sum_of_abs_errors: sum{i in I}(ep[i] + em[i]);

To call the model

def lad_regression(X, y):
    ampl = AMPL()
    ampl.read("lad_regression.mod")

    n, k = X.shape

    # note use of Python style zero based indexing
    ampl.set["I"] = list(range(n))
    ampl.set["J"] = list(range(k))

    ampl.param["y"] = y
    ampl.param["X"] = X

    ampl.option["solver"] = SOLVER
    ampl.solve()

    return ampl


m = lad_regression(X, y)
m.display("m")
m.display("b")

The issue shows up when X is assigned to ampl.param["X"], X is a npdarray and comes from:

X, y = make_regression(n_samples=n_samples, n_features=n_features, noise=noise)

Chapter 6: Conic Optimization

Use Ipopt, Mosek, Gurobi, Knitro to solve SOCP and exponential cones (Gurobi only SOCP). Progress status for text only:

  • Economic order quantity
  • The Kelly Criterion
  • Markowitz portfolio optimization problem revisited: Mosek fails
  • Optimal design of multi-layered building insulation
  • Training Support Vector Machines with Conic Programming
  • Extra material: Luenberger’s Investment Wheel
  • Extra material: Optimal Growth Portfolio

Progress status for models:

  • Economic order quantity
  • The Kelly Criterion
  • Markowitz portfolio optimization problem revisited: Mosek fails
  • Optimal design of multi-layered building insulation
  • Training Support Vector Machines with Conic Programming
  • Extra material: Luenberger’s Investment Wheel
  • Extra material: Optimal Growth Portfolio

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.