MrMarc

3153 Reputation

18 Badges

14 years, 200 days

MaplePrimes Activity


These are questions asked by MrMarc

I can solve a [0,1] linear programming problem by using:

LPSolve(Ob, con, assume = binary);


I managed to solve [-1,1] linear programming problem by using the transformation
2*w[i]-1 ie   2*0-1=-1 and 2*1-1=1 as follows:

LPSolve(add(PP[i]*(2*w[i]-1), i = 1 .. NC)-add(Draw[i]*(2*w[i]-1), i = 1 .. NC), {add(w[i], i = 1 .. NC) = PS}, maximize = true, assume = binary);


Now my question is how can I solve a [-1,0,1] problem?
I tried to use:

So Robert, how can we solve the below problem with the Optimization package
in Maple?

A quadratic objective xTQx can be handled by introducing a new variable t,
making the objective "minimize t", adding the constraint  xTQx <= t,
and converting this constraint to SOC form

Test.mw

I have this data (see attached worksheet). I then run the below code
and then I get the output (see below). The problem is that I have explicity
stated in constraints 3 (con3) that w[i] should be larger than or
equal to zero. Still I get negative solution ie w[1]=-1.47*10^(-18).
Why is that?

The funny thing is that when I change constraint 3 to w[i]>=0.01 then I get :

My next project will be to understand second order cone optimization
and submit an easy to understand example to the maple application
center inorder to help other people understand it as well. Due to the
extreme technical nature of the problem I have offered various "experts"
up to 500 USD if they can explain it to me in simple terms.

Most optimization people have told me: We want $$$$$$$$ to explain it to you.
Apparently, everyone ells should share their knowledge to the world

If I run the below code which finds the optimal portfolio weights given a portfolio
target return G then I get a nice solution:

restart:
with(Optimization):
with(LinearAlgebra):

n := 4:
C := 10000:
G := .1*C:

X := Vector[column]([seq(x[i], i = 1 .. n)]):
ER := Vector[column]([0.5e-1, -.20, .15, .30]):
Q := Matrix([[0.8e-1, -0.5e-1, -0.5e-1, -0.5e-1], [-0.5e-1, .16, -0.2e-1, -0.2e-1], [-0.5e-1, -0.2e-1, .35, 0.6e-1], [-0.5e-1, -0.2e-1, 0.6e-1, .35]]):

First 9 10 11 12 13 14 15 Last Page 11 of 35