-1

I want to maximize Ax = b where A is an m-by-n matrix and x is an n-vector. The constraints on x are that its entries sum to 1 and that A x >= 0.

Jesica
  • 15
  • 1
  • 8

1 Answers1

3

Using CVXPY instead:

from cvxpy import *
import numpy as np

m = 30
n = 10

# generate random data
np.random.seed(1)
A = np.random.randn(m,n)
b = np.random.randn(m)

# optimization variable
x = Variable(n)

# build optimization problem
prob = Problem( Maximize(sum(A*x)), [ sum(x) == 1, A*x >= 0 ])

# solve optimization problem and prints results
result = prob.solve()
print x.value

This optimization problem is unbounded and, thus, there is no optimal solution.

Rodrigo de Azevedo
  • 1,097
  • 9
  • 17