HeroldEcon
HeroldEcon

Reputation: 11

Minimize the L1-Norm between [a*A(x1,x2)-b] by finding unknown coefficients/probabilities x1 and x2

I have the following problem: I am trying to write an optimisation routine in Julia that calculates the potentially unknown coefficients of a transition probability matrix that guarantees me I get from state vector a to new state vector b. As A is a transition probability matrix, the coefficients x1 and x2 have to non-negative and x1 and 1-x1 (or x2 and 1-x2) have to be equal to 1.

using JuMP, GLPK

# Preparing an optimization model
m = Model(GLPK.Optimizer)

# Declaring variables
@variable(m, 0<= x1 <=1)
@variable(m, 0<= x2 <=1)

a = [0.25; 0.5];
b = [0.375; 0.375];

f(x1,x2) = (a'*[x1 1-x1; 1-x2 x2]) - b'

# Setting the objective
@objective(m, Min, f(0.75,0.25))


# Printing the prepared optimization model
print(m)

# Solving the optimization problem
JuMP.optimize!(m)

Upvotes: 1

Views: 63

Answers (1)

Przemyslaw Szufel
Przemyslaw Szufel

Reputation: 42244

While it is not clear what you need and there is no question stated here are some comments:

  1. The goal function needs to state a single value not a vector, eg. it could be:
    f(x1,x2,a,b) = ((a'*[x1 1-x1; 1-x2 x2]) - b')[1]
    
  2. If you need x1+x2==1 you could add a constraint:
    @constraint(m, x1+x2==1)
    
  3. The goal function should reference decision variables so perhaps you want:
    @objective(m, Min, f(x1,x2,a,b))
    

Upvotes: 0

Related Questions