L1-范数最小化 [英] L1-Norm minimization

查看:53
本文介绍了L1-范数最小化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用线性编程来最小化以下功能.我无法包含目标功能的图像.单击此目标函数以查看我要优化的内容.我的问题是python中是否有任何库或函数可以为我做这种优化,还是应该编写代码?

I am trying to minimize the following function using Linear programming. I am unable to include the image of my objective function. Click this Objective Function to view what I am trying to optimize. My question is there any library or function in python which can do this optimization for me or should I be writing the code?

推荐答案

import cvxpy as cp
import numpy as np

N=10
M=100

U = np.random.random((M,N))
m = np.random.random(M)
t = cp.Variable(M)
x = cp.Variable(N)

prob = cp.Problem(cp.Minimize(cp.sum(t)), [-t<=U@x-m, U@x-m<=t])
optimal_value = prob.solve()
print("t=",t.value)
print("x=",x.value)
print("val=",optimal_value)

这篇关于L1-范数最小化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆