Questions tagged [cvx]

CVX is a Matlab-based modeling system for convex optimization. CVX turns Matlab into a modeling language, allowing constraints and objectives to be specified using standard Matlab expression syntax.

CVX is a Matlab-based modeling system for convex optimization. CVX turns Matlab into a modeling language, allowing constraints and objectives to be specified using standard Matlab expression syntax.

99 questions
0
votes
1 answer

CVXR Iteration Limit

Using R, I am running a mixed integer optimization which uses the ECOS_BB solver option when using the standard solve or psolve functions for CVXR. How can I set the max iterations? I have looked everywhere. None of the ECOS_BB native options do…
0
votes
1 answer

Base Apply and Elementwise Function CVXR

Is there a way to use base::apply and a CVXR elementwise function to apply an elementwise function to every column of a matrix? Assuming the length of the vector matches the number of rows of the matrix, I'd like to be able to make my objective…
0
votes
0 answers

Getting DCPError when trying to solve Dual form of SVM using CVXPY

I am trying to create a SVM using cvxpy, by solving its Dual form Here is the code: import cvxpy as cp import numpy as np DIM = 2 NUM = 50 #COLORS = ['red', 'blue'] M1 = np.ones((DIM,)) M2 = 2 * np.ones((DIM,)) C1 = np.diag(0.3 *…
Siladittya
  • 1,156
  • 2
  • 13
  • 41
0
votes
0 answers

How to run MOSEK solver in CVXOPT

I have written a small code to do a simple min variance optimisation using CVXOPT, you can see the whole code below By using solvers.qp(P, q, G, h, A, b) in CVXOPT the code runs fine and it find a solution solvers.qp(P, q, G, h, A, b) I wanted to…
Marco_sbt
  • 309
  • 1
  • 12
0
votes
1 answer

Solving a Convex and Linear Program

Hello all, I am very new to optimization. What could be the best approach to solve this problem? I have used cplex to solve these ending up in the bay. Can any one guide me for possible solution using matlab. The code I used in Cplex dvar…
0
votes
0 answers

Error when using linear constraints in CVX (Matlab)

I am trying to use Disciplined Convex Programming (CVX) to solve a family of optimization problems in Matlab. But I keep getting the error the || and && operators must be convertible to logical scalar values". I have tried replacing the equality…
0
votes
1 answer

CVXR: addressing non-diagonal elements of a matrix of variables

Suppose that in CVXR I have a definition A <- Variable(3,3) and would like to maximize the function "sum of the square roots of the non-diagonal elements". However, if I write something like sum(sqrt(A))-sum(sqrt(diag(A))), the first function being…
Ilonpilaaja
  • 1,169
  • 2
  • 15
  • 26
0
votes
0 answers

CVXR: not recognizing a convex function

I am trying to do some quadratic optimization with linear constraints, using CVXR. I have the following matrix in R: HL <- matrix(c( s[2]*sqp[2]*sqq[2],0,0,0,0,0,0,0,0,0,0,0, 0,s[3]*sqp[3]*sqq[3],0,0,0,0,0,0,0,0,0,0, …
Ilonpilaaja
  • 1,169
  • 2
  • 15
  • 26
0
votes
1 answer

Extension to the CVXR example cvxr_kelly-strategy not DCP compliant?

I've been working through some of the example code trying to learn CVX and spinning my wheels trying to figure out the extension to the Kelly example in CVXR: "Extensions: As observed in some trajectories above, wealth tends to drop by a significant…
SCW
  • 3
  • 4
0
votes
0 answers

One or more output arguments not assigned

I want to implement a convex-relaxation for the E-optimality design criterion, that is: By defining the optimization problem would be I have implemented in Matlab using this function function [d] = e_optimality(Uk, s, sigma) %% E-OPTIMALITY…
VanBaffo
  • 259
  • 1
  • 2
  • 13
0
votes
1 answer

Still don't understand how to add a slack variable in optimal problem

Now I am trying to add a slack variable to this optimal problem: http://ask.cvxr.com/t/why-does-the-optimal-value-become-nan-sometimes/6035 And here is my reference about adding slack variable section 6 in this website…
Shine Sun
  • 151
  • 2
  • 9
0
votes
0 answers

Translating an optimization problem from CVX to CVXPY?

I am attempting to translate a semidefinite programming problem from CVX to CVXPY as described here. My attempt follows: import cvxpy as cvx import numpy as np c = [0, 1] n = len(c) # Create optimization variables. f = cvx.Variable((n, n),…
Wulfsta
  • 1
  • 2
0
votes
0 answers

matlab CVX problems to python cvxpy

This is my Matlab CVX linkpair=[link_1 -link_2]; unlinkpair=[unlink_1 -unlink_2]; m=size(linkpair,2); n=size(linkpair,1); %%%%%%%%%%%%%%%%%%%%%%%%%%%parametres%%%%%%%%%%%%%%%%%%%%%%%%%%%%% C=100; B=10; d=10; W=[]; delta=[]; for…
0
votes
1 answer

Package CVXR: Error in as.vector(data): no method for coercing this S4 class to a vector

I am trying to use the package CVXR to do my optimization. I am following the instructions from this page: https://rviews.rstudio.com/2017/11/27/introduction-to-cvxr/ My problem is a little complicated to I want to put my coefficient variables (the…
TDo
  • 686
  • 4
  • 9
  • 22
0
votes
1 answer

Convex optimization in R with sqlp function

With the following convex problem: minimize ∥Ax−b∥2 subject to l⪯x⪯u It could be done in matlab with CVX, with SDPT3 solver: cvx_begin variable x(n) minimize( norm(A*x-b) ) subject to l <= x <= u cvx_end In this way, R has a…
PeCaDe
  • 277
  • 1
  • 8
  • 33