CVXR | An R modeling language for convex optimization problems | Math library

 by   cvxgrp R Version: v1.0-8 License: Apache-2.0

kandi X-RAY | CVXR Summary

kandi X-RAY | CVXR Summary

CVXR is a R library typically used in Utilities, Math applications. CVXR has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

CVXR provides an object-oriented modeling language for convex optimization, similar to CVX, CVXPY, YALMIP, and Convex.jl. It allows the user to formulate convex optimization problems in a natural mathematical syntax rather than the restrictive standard form required by most solvers. The user specifies an objective and set of constraints by combining constants, variables, and parameters using a library of functions with known mathematical properties. CVXR then applies signed disciplined convex programming (DCP) to verify the problem’s convexity. Once verified, the problem is converted into standard conic form using graph implementations and passed to a cone solver such as ECOS or SCS. CVXR includes several open source solvers in addition to the default OSQP, ECOS and SCS. Recent (1.x+) versions also include support for commercial solvers such as MOSEK, GUROBI and CPLEX. For details and examples, we refer you to Fu, Narasimhan, Boyd (2020). If you use CVXR in your work, please cite this reference. (The R command citation("CVXR", bibtex = TRUE) will also give you a bibtex-formatted entry.).
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              CVXR has a low active ecosystem.
              It has 135 star(s) with 22 fork(s). There are 20 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 19 open issues and 40 have been closed. On average issues are closed in 87 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of CVXR is v1.0-8

            kandi-Quality Quality

              CVXR has no bugs reported.

            kandi-Security Security

              CVXR has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              CVXR is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              CVXR releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of CVXR
            Get all kandi verified functions for this library.

            CVXR Key Features

            No Key Features are available at this moment for CVXR.

            CVXR Examples and Code Snippets

            No Code Snippets are available at this moment for CVXR.

            Community Discussions

            QUESTION

            Problems with DCP rules in CVXR
            Asked 2021-Jun-07 at 18:48

            I am using the CVXR modelling package to solve a convex optimization problem. I know for sure that the problem is convex and that it follows the DCP rules, but if I check the DCP rules using CVXR it returns False. However, if I take the exact same problem and check it using CVXPY it returns True (as expected)

            What is happening here? I attach a minimal reproducible example of this behavior in R and Python:

            R code using CVXR ...

            ANSWER

            Answered 2021-Jun-07 at 18:48

            The problem is the negative eigenvalue in the R matrix. If you fix that by setting it to zero, say, then it satisfies the dcp condition. I have also fixed the syntax errors in the code in the question and removed the redundant :: . Another possibility (not shown) is to use nearest_spd in the pracma package to adjust the R matrix.

            Source https://stackoverflow.com/questions/67874107

            QUESTION

            Write Dirichlet Log Likelihood with DCP ruleset
            Asked 2020-Dec-11 at 12:31

            I would like to write the log likelihood of the Dirichlet density as a disciplined convex programming (DCP) optimization problem with respect to the parameters of the Dirichlet distribution alpha. However, the log likelihood

            ...

            ANSWER

            Answered 2020-Dec-11 at 12:18

            As you note, np.log(gamma(alpha.sum())) and -np.log(gamma(alpha)).sum() have different curvature, so you need to combine them as

            Source https://stackoverflow.com/questions/62251427

            QUESTION

            Mosek memory issue for large linear programming
            Asked 2020-Sep-09 at 13:24

            I use MOSEK to run a very large linear programming problem in Matlab (32768 unknowns and 691621 constraints). The code is submitted in a Linux based cluster. In the bash file I request the following amount of memory:

            ...

            ANSWER

            Answered 2020-Sep-09 at 13:04
            1. Irrelevant in Matlab.

            2. Irrelevant and imposible in Matlab. The MEX interface feeds the problem into Mosek in one go and takes care of all allocations itself.

            3. For MSK_IPAR_NUM_THREADS to be respected you must restart the whole process i.e. Matlab. See https://docs.mosek.com/9.2/faq/faq.html#mosek-is-ignoring-the-limit-on-the-number-of-threads. However, when you set MSK_IPAR_INTPNT_MULTI_THREAD = 'MSK_OFF' then Mosek will use 1 thread regardless of the number of all threads available i.e. the number printed to the log is just an upper bound. You should be able to see in the task manager/top/whatever other CPU load tracker that only 1CPU is in use.

            The basic question is: have you tried to run the problem without any memory limits to see if it works at all and estimate the memory consumption? Does it run on other machines?

            Source https://stackoverflow.com/questions/63809939

            QUESTION

            Pass a string for objective function in CVXR
            Asked 2020-Jul-18 at 10:21

            I am trying to write a wrapper function around CVXR, such that the 'objective' and 'constraint' can be passed by a function. I using the following example:

            Example:

            ...

            ANSWER

            Answered 2020-Jul-18 at 10:21

            Maybe you can try parse with eval like below

            Source https://stackoverflow.com/questions/62967212

            QUESTION

            Optimize with indexing in linear programming
            Asked 2020-Jun-18 at 08:21

            I have encountered several optimization problems that involve identifying one or more indices in a vector that maximizes or minimizes a cost. Is there a way to identify such indices in linear programming? I'm open to solutions in mathprog, CVXR, CVXPY, or any other API.

            For example, identifying an index is needed for change point problems (find the index at which the function changes), putting distance constraints on the traveling salesman problem (visit city X before cumulative distance Y).

            As a simple example, suppose we want to identify the location in a vector where the sum on either side is the most equal (their difference is smallest). In this example, the solution is index 5:

            ...

            ANSWER

            Answered 2020-Jun-17 at 21:07

            At the end of the day, if you are selecting things by index, I think you need to work this with a set of corresponding binary selection variables. The fact that you are selecting "things in a row" as in your example problem is just something that needs to be handled with constraints on the binary variables.

            To solve the problem you posed, I made a set of binary selection variables, call it s[i] where i = {0, 1, 2, ..., len(x)} and then constrained:

            Source https://stackoverflow.com/questions/62432731

            QUESTION

            CVXR: Problem with solve() - Error in as.vector(data): no method for coercing this s4 class to a vector
            Asked 2020-Apr-29 at 08:29

            I'm trying to minimize this function:

            \min_{\mu} \sum_{t=T}^T \| y_t - \mu_t \|2 + \lambda \sum{t=1}^{T-1} \|mu_{t+1}-\mu_{t}\|_2

            where: y and mu are p*T matraxis. Everything compiles well until I use the solve() function.

            Here is what I coded with y being a p*obs matrix

            ...

            ANSWER

            Answered 2020-Apr-29 at 08:29

            Problem is missing in your code:

            Source https://stackoverflow.com/questions/61487675

            QUESTION

            R CVXR matrix multiplication %*% Error in mul_dims_promote(lh_dim, rh_dim) : Incompatible dimensions
            Asked 2020-Apr-06 at 22:38

            Hello I am trying to run the example from here: http://rtutorial.altervista.org/lp_solvers.html

            A snippet and test where it goes wrong:

            ...

            ANSWER

            Answered 2020-Apr-06 at 22:38

            Try replacing the line C<-c(2,4,3) with C <- matrix(c(2,4,3), nrow = 1). That follows the syntax of the later example on that web page, and then that example works for me. The later example now works for me too, (hat tip Jordan) - replace ‘x3 <- Int(1)’ with ‘x3 <-Variable(1, integer=TRUE)’, though the link will probably be updated shortly.

            Source https://stackoverflow.com/questions/60909930

            QUESTION

            R optim with a hidden restriction
            Asked 2019-Dec-18 at 21:34
            Background

            I'm doing empirical likelihood maximization, and hit an error. The statistics is a bit complex and I describe the error like following.

            Problem

            Suppose I have multivariate function with domain: ,

            And I want to minimize the function in the domain.

            Here is the counter plot for my function, the optimum seems to be x = y = 0.5 and z = 0.

            ...

            ANSWER

            Answered 2019-Dec-15 at 19:10

            Here is the performance comparison among several approaches

            Source https://stackoverflow.com/questions/59342658

            QUESTION

            using map2 and map/lapply over 3 objects in R
            Asked 2019-Nov-23 at 14:25

            I am trying to map two lists over myEq with a third numeric input which is not the same length as mus and Sigmas.

            The equation I want to map over:

            ...

            ANSWER

            Answered 2019-Nov-23 at 14:25

            I think what you need to do is first convert mus to numeric and then for every value in lmd run myEq in map2.

            Source https://stackoverflow.com/questions/59008528

            QUESTION

            map2 over lists to solve convex optimisation problems based on means convariance matrices
            Asked 2019-Nov-22 at 00:04

            I am trying to apply map2 over a series of lists I have to solve a convex optimisation problem.

            With the data I try the following function to solve my equation.

            ...

            ANSWER

            Answered 2019-Nov-21 at 23:45

            You are passing the parameters incorrectly. Try

            Source https://stackoverflow.com/questions/58985346

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install CVXR

            This package is now released on CRAN, so you can install the current released version as you would any other package for R, version 3.4 and higher. (CVXR is known to work with earlier versions of R too, but we don’t check our releases against older versions of R.).

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link