julia - 如何在 Julia 中制作 inf 矩阵?
问题描述
我想将我的问题的最低边界设置为 -inf 也没有限制,这里是代码
@time begin
using COSMO, SparseArrays, LinearAlgebra
using NPZ
Matrix10 = npzread("C:/Users/skqkr/Desktop/Semesterarbeit/Chiwan_Q1.npz")
q = Matrix10["p"];
P = sparse(Matrix10["Q"]);
A = sparse(Matrix10["G"]);
h = Matrix10["h"];
l = Matrix10["l"];
# First, we decide to solve the problem with two one-sided constraints using `COSMO.Nonnegatives` as the convex set:
Aa = [-A; A]
ba = [h; -l]
constraint1 = COSMO.Constraint(Aa, ba, COSMO.Nonnegatives);
# Next, we define the settings object, the model and then assemble everything:
settings = COSMO.Settings(verbose=true);
model = COSMO.Model();
assemble!(model, P, q, constraint1, settings = settings);
res = COSMO.optimize!(model);
# Alternatively, we can also use two-sided constraints with `COSMO.Box`:
constraint1 = COSMO.Constraint(A, zeros(3), COSMO.Box(-l, h));
model = COSMO.Model();
assemble!(model, P, q, constraint1, settings = settings);
res_box = COSMO.optimize!(model);
end
所以我想要
l = Matrix10["l"];
这里 ll 作为一个没有限制的矩阵,所以 qp 的约束将是这种形式。A*X<h
我应该怎么做才能使限制减去无穷大。
谢谢你!!
解决方案
推荐阅读
- c - 当函数头中的返回类型为默认值且未提供返回语句时,为什么会发生未定义的行为?
- c# - 在 XAML 中包装属性
- applescript - 使用带有 applescript 和 novation 启动板的 midipipe 控制 OBS
- javascript - 如何在 React Native 中绘制六边形图像
- reactjs - useEffect 和 ESlint 穷举-deps 规则
- python - Spark.sql:删除列名上的表名
- c# - 正则表达式匹配无法在两个字符之间找到文本
- r - 使两个输入相互依赖
- python - Discord.py 上 SQLite 3 的排序问题
- typescript - 使用纱线工作区从文件中解析而不是在 Lerna monorepo 中输入