-
-
Save osin-vladimir/a8242115728343a5378a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from cvxpy import * | |
| import numpy | |
| numpy.random.seed(1) | |
| n = 20 | |
| x1 = Variable(n) | |
| x2 = Variable(n) | |
| a = Variable(n) | |
| objective = Minimize(2*x1 + 3*a) | |
| constraints = [a>=x2-10, | |
| a>=10-x2, | |
| x1+x2<=3, | |
| x2-x1>=-3, | |
| x2-x1<=7, | |
| x1+x2>=7] | |
| prob = Problem(objective, constraints) | |
| result = prob.solve() | |
| print result | |
| print x1.value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment