Comments (4)
Travis,
Do you happen to know what the optimal objective value is? I've increased
the maxiters for cvxopt and it seems to solve it, but I'm not sure if it's
accurate.
Eric
On Tue, Nov 5, 2013 at 1:23 AM, Travis Erdman [email protected]:
The code below (feel free to use it as a test case or example problem)
calculates the maximum expected log return for investment in 10 different
assets with 10 different outcome scenarios. The objective is similar to
that of acent.py, but it is a weighted sum of logs. The solvers do not
converge to the solution within maxiter, though it is a rather
straightforward problem. Any ideas?import cvxpy as cvx
import cvxoptscenario_probabilities = cvx.numpy.array((0.3,0.15,0.1,0.1,0.06,0.06,0.06,0.06,0.06,0.05)).reshape(1,-1)
joint_returns = cvx.numpy.array(
[[ 1.09, 0.96, 0.95, 1.06, 1.09, 1.54, 1.16, 1.01, 0.82, 1.04],
[ 1.14, 1.02, 1.04, 1.07, 1.02, 0.93, 1.09, 0.85, 1.47, 1.21],
[ 1.01, 1.35, 0.95, 0.81, 1.05, 0.85, 1.02, 0.88, 1. , 1.05],
[ 1.1 , 0.96, 1.13, 1.95, 1.06, 0.81, 1.02, 1.12, 0.95, 0.97],
[ 1.12, 0.9 , 1. , 1.08, 1.1 , 1.07, 1.7 , 0.94, 0.97, 0.93],
[ 1.64, 1.01, 1.25, 0.97, 0.93, 1.03, 0.81, 1.13, 1.02, 0.91],
[ 0.85, 0.95, 0.98, 0.99, 1.1 , 1.02, 1.04, 1.67, 0.96, 0.96],
[ 1.15, 0.97, 1.54, 0.95, 1.09, 1.14, 1.08, 0.9 , 0.91, 0.82],
[ 1.13, 0.95, 1.1 , 1.03, 1.89, 1.2 , 0.97, 1.04, 1.04, 1. ],
[ 0.93, 1.08, 0.84, 0.97, 0.95, 0.8 , 0.95, 0.98, 1.29, 1.46]])portfolio = cvx.Variable(10)
riskfree = cvx.Variable()
scenario_returns = riskfree + joint_returns.T * portfolio
objective = scenario_probabilities * cvx.log(scenario_returns)
p = cvx.Problem(cvx.Maximize(objective),[scenario_returns >= 1e-5, riskfree + sum(portfolio) <= 1])p.solve()
—
Reply to this email directly or view it on GitHubhttps://github.com/cvxgrp/cvxpy/issues/21
.
from cvxpy.
The log atom uses a different solver under the hood. It uses the cvxopt cpl solver. So you can change maxiters using
import cvxopt.solvers as cvxopt
solvers.options["maxiters"] = 1000
Or your favorite maxiters.
Eric
On Nov 5, 2013, at 10:29 AM, Travis Erdman [email protected] wrote:
Yes, the problem and solution are given on p. 1122 of the paper "A Strategy
Which Maximizes the Geometric Mean Return on Portfolio Investments" by
Vander Weide et al.http://www.albany.edu/faculty/faugere/PhDcourse/GeomeanReturn.pdf
Per the paper, exp(objective.value) should be ~ 1.662; objective.value
should be ~ 0.508.I tried to do a thorough search for increasing maxiter, but couldn't find
out how to do it.On Tue, Nov 5, 2013 at 9:13 AM, Eric Chu [email protected] wrote:
Travis,
Do you happen to know what the optimal objective value is? I've increased
the maxiters for cvxopt and it seems to solve it, but I'm not sure if it's
accurate.Eric
On Tue, Nov 5, 2013 at 1:23 AM, Travis Erdman [email protected]:
The code below (feel free to use it as a test case or example problem)
calculates the maximum expected log return for investment in 10
different
assets with 10 different outcome scenarios. The objective is similar to
that of acent.py, but it is a weighted sum of logs. The solvers do not
converge to the solution within maxiter, though it is a rather
straightforward problem. Any ideas?import cvxpy as cvx
import cvxoptscenario_probabilities =
cvx.numpy.array((0.3,0.15,0.1,0.1,0.06,0.06,0.06,0.06,0.06,0.05)).reshape(1,-1)joint_returns = cvx.numpy.array( \
[[ 1.09, 0.96, 0.95, 1.06, 1.09, 1.54, 1.16, 1.01, 0.82, 1.04], \
[ 1.14, 1.02, 1.04, 1.07, 1.02, 0.93, 1.09, 0.85, 1.47, 1.21], \
[ 1.01, 1.35, 0.95, 0.81, 1.05, 0.85, 1.02, 0.88, 1. , 1.05], \
[ 1.1 , 0.96, 1.13, 1.95, 1.06, 0.81, 1.02, 1.12, 0.95, 0.97], \
[ 1.12, 0.9 , 1. , 1.08, 1.1 , 1.07, 1.7 , 0.94, 0.97, 0.93], \
[ 1.64, 1.01, 1.25, 0.97, 0.93, 1.03, 0.81, 1.13, 1.02, 0.91], \
[ 0.85, 0.95, 0.98, 0.99, 1.1 , 1.02, 1.04, 1.67, 0.96, 0.96], \
[ 1.15, 0.97, 1.54, 0.95, 1.09, 1.14, 1.08, 0.9 , 0.91, 0.82], \
[ 1.13, 0.95, 1.1 , 1.03, 1.89, 1.2 , 0.97, 1.04, 1.04, 1. ], \
[ 0.93, 1.08, 0.84, 0.97, 0.95, 0.8 , 0.95, 0.98, 1.29, 1.46]])portfolio = cvx.Variable(10)
riskfree = cvx.Variable()
scenario_returns = riskfree + joint_returns.T * portfolio
objective = scenario_probabilities * cvx.log(scenario_returns)
p = cvx.Problem(cvx.Maximize(objective),[scenario_returns >= 1e-5,
riskfree + sum(portfolio) <= 1])p.solve()
—
Reply to this email directly or view it on GitHub<
https://github.com/cvxgrp/cvxpy/issues/21>
.—
Reply to this email directly or view it on GitHubhttps://github.com/cvxgrp/cvxpy/issues/21#issuecomment-27792365
.—
Reply to this email directly or view it on GitHub.
from cvxpy.
Yes, the problem and solution are given on p. 1122 of the paper "A Strategy
Which Maximizes the Geometric Mean Return on Portfolio Investments" by
Vander Weide et al.
http://www.albany.edu/faculty/faugere/PhDcourse/GeomeanReturn.pdf
Per the paper, exp(objective.value) should be ~ 1.662; objective.value
should be ~ 0.508.
I tried to do a thorough search for increasing maxiter, but couldn't find
out how to do it.
On Tue, Nov 5, 2013 at 9:13 AM, Eric Chu [email protected] wrote:
Travis,
Do you happen to know what the optimal objective value is? I've increased
the maxiters for cvxopt and it seems to solve it, but I'm not sure if it's
accurate.Eric
On Tue, Nov 5, 2013 at 1:23 AM, Travis Erdman [email protected]:
The code below (feel free to use it as a test case or example problem)
calculates the maximum expected log return for investment in 10
different
assets with 10 different outcome scenarios. The objective is similar to
that of acent.py, but it is a weighted sum of logs. The solvers do not
converge to the solution within maxiter, though it is a rather
straightforward problem. Any ideas?import cvxpy as cvx
import cvxoptscenario_probabilities =
cvx.numpy.array((0.3,0.15,0.1,0.1,0.06,0.06,0.06,0.06,0.06,0.05)).reshape(1,-1)joint_returns = cvx.numpy.array(
[[ 1.09, 0.96, 0.95, 1.06, 1.09, 1.54, 1.16, 1.01, 0.82, 1.04],
[ 1.14, 1.02, 1.04, 1.07, 1.02, 0.93, 1.09, 0.85, 1.47, 1.21],
[ 1.01, 1.35, 0.95, 0.81, 1.05, 0.85, 1.02, 0.88, 1. , 1.05],
[ 1.1 , 0.96, 1.13, 1.95, 1.06, 0.81, 1.02, 1.12, 0.95, 0.97],
[ 1.12, 0.9 , 1. , 1.08, 1.1 , 1.07, 1.7 , 0.94, 0.97, 0.93],
[ 1.64, 1.01, 1.25, 0.97, 0.93, 1.03, 0.81, 1.13, 1.02, 0.91],
[ 0.85, 0.95, 0.98, 0.99, 1.1 , 1.02, 1.04, 1.67, 0.96, 0.96],
[ 1.15, 0.97, 1.54, 0.95, 1.09, 1.14, 1.08, 0.9 , 0.91, 0.82],
[ 1.13, 0.95, 1.1 , 1.03, 1.89, 1.2 , 0.97, 1.04, 1.04, 1. ],
[ 0.93, 1.08, 0.84, 0.97, 0.95, 0.8 , 0.95, 0.98, 1.29, 1.46]])portfolio = cvx.Variable(10)
riskfree = cvx.Variable()
scenario_returns = riskfree + joint_returns.T * portfolio
objective = scenario_probabilities * cvx.log(scenario_returns)
p = cvx.Problem(cvx.Maximize(objective),[scenario_returns >= 1e-5,
riskfree + sum(portfolio) <= 1])p.solve()
—
Reply to this email directly or view it on GitHub<
https://github.com/cvxgrp/cvxpy/issues/21>
.—
Reply to this email directly or view it on GitHubhttps://github.com/cvxgrp/cvxpy/issues/21#issuecomment-27792365
.
from cvxpy.
Thank you, Eric. I'm glad to know how to adjust this for my future work. Examination of the solution indicates that I formulated this problem incorrectly. Correct formulation follows, with expected results in just 8 iterations.
import cvxpy as cvx
import cvxopt
scenario_probabilities = cvx.numpy.array((0.3,0.15,0.1,0.1,0.06,0.06,0.06,0.06,0.06,0.05)).reshape(1,-1)
joint_returns = cvx.numpy.array( \
[[ 1.09, 0.96, 0.95, 1.06, 1.09, 1.54, 1.16, 1.01, 0.82, 1.04], \
[ 1.14, 1.02, 1.04, 1.07, 1.02, 0.93, 1.09, 0.85, 1.47, 1.21], \
[ 1.01, 1.35, 0.95, 0.81, 1.05, 0.85, 1.02, 0.88, 1. , 1.05], \
[ 1.1 , 0.96, 1.13, 1.95, 1.06, 0.81, 1.02, 1.12, 0.95, 0.97], \
[ 1.12, 0.9 , 1. , 1.08, 1.1 , 1.07, 1.7 , 0.94, 0.97, 0.93], \
[ 1.64, 1.01, 1.25, 0.97, 0.93, 1.03, 0.81, 1.13, 1.02, 0.91], \
[ 0.85, 0.95, 0.98, 0.99, 1.1 , 1.02, 1.04, 1.67, 0.96, 0.96], \
[ 1.15, 0.97, 1.54, 0.95, 1.09, 1.14, 1.08, 0.9 , 0.91, 0.82], \
[ 1.13, 0.95, 1.1 , 1.03, 1.89, 1.2 , 0.97, 1.04, 1.04, 1. ], \
[ 0.93, 1.08, 0.84, 0.97, 0.95, 0.8 , 0.95, 0.98, 1.29, 1.46]])
portfolio = cvx.Variable(10)
scenario_returns = joint_returns.T * portfolio
objective = scenario_probabilities * cvx.log(scenario_returns)
p = cvx.Problem(cvx.Maximize(objective),[sum(portfolio) == 1])
p.solve()
from cvxpy.
Related Issues (20)
- DCCP error that arises in resolving linear inequality constraints
- SCIP solution not returned when total node limit reached HOT 4
- How do I suppress the ECOS solver warning HOT 7
- Mutating NumPy array inplace with cp.Expression should have a clear error message HOT 1
- raise DCPError( cvxpy.error.DCPError: Problem does not follow DCP rules. Specifically: The objective is not DCP. Its following subexpressions are not:
- Can Variable be converted to Tensor HOT 3
- pypi dependencies list clarabel twice HOT 5
- Adding cp.squeeze
- How to implement non-zero count constraint HOT 5
- ImportError: libscip.so.8.0: cannot open shared object file: No such file or directory HOT 3
- Square-root cost - Multi-Period Trading via Convex Optimization HOT 2
- MindOpt solver backend HOT 2
- Problem with newer python versions HOT 1
- Remove ECOS dependency HOT 2
- SCS solver import error HOT 3
- ECOS solver failed HOT 2
- Fix all public functions that do not have return type annotations HOT 2
- add DAQP as a solver HOT 3
- Indexing reverses the orders of nested lists HOT 4
- work->info->status_polish segmentation fault HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cvxpy.