Thank you, Jeff and Bert!

1. As to the unconstrained problem I gave (which is not my main concern) I should have added that in geometric programming it is assumed that the target variables are positive, thus x,y > 0. This would also rule out my given solution, (0, 0), of the unconstrained problem. The positivity constraint in geometric programming is a consequence of the role the logarithmic transformation plays in the theory of geometric programming.

2. However, my concern is to find out how to define equality constraints and submit them as an argument to gp(), so I wanted to try out the most simple case. But it seems as gp() implicitely assumes there must be at least inequality constraints. If I add inequality constraints, then my equality constraints are not ignored by gp(). So, in the following example, I added a non-binding inequality constraint, and I receive the correct solution, this time for the correct reasons:

## Minimise P + Q subject to P*Q = 1 and 0.5*P^(-1)*Q^(-1) <= 1
F0 <- diag(2) # [m0 * n] m0 = number of terms of the posynomial, n = number of variables
g0 <- log(matrix(1,2,1))            #  [m0 * 1]
bexp <- 1
A <-  matrix(c(1,1), 1, 2)          #  one constraint, one row
b <-  log(matrix(bexp, 1, 1))
F1 <- matrix(c(-1,-1), 1, 2) # additional (redundant) inequality constraint [m1 * n] m1 = number of terms of the posynomial
g1 <- log(matrix(0.5*bexp, 1, 1))   #  [m1 * 1]
RES <- gp(F0, g0, FList=list(F1), gList=list(g1), A=A, b=b)
sol <- RES$pdv$x
c(sol)  # [1] 1 1
RES <- gp(F0, g0, FList=list(F1), gList=list(g1)) # without the equality constraint
sol <- RES$pdv$x
c(sol)  # [1] 0.7071069 0.7071069

Best regards,

Wolfgang






Am 2025-08-01 04:18, schrieb Jeff Reichman:
In gp(F0, g0, A = A, b = b) : No restrictions provided, trying solve()


This likely means that while you've specified A and b, the solver doesn't recognize any inequality (<=) or equality (=) restrictions - because in the context of the gp() function from the CVXR or similar geometric programming
libraries in R, you're expected to provide explicit inequality/equality
markers or properly formatted constraint matrices.

So what's missing? Probably an argument like ineq = ... or eq = ... to
declare the type of constraint.

Here's how to express your constraint properly, assuming the library expects
inequalities or equalities to be marked explicitly:

# Properly declare equality constraints
gp(F0, g0, eq=A, eq.b=b)

Or possibly (depending on the package):

gp(F0, g0, Aeq=A, beq=b)

If the solver expects inequality constraints:

gp(F0, g0, A=A, b=b, meq=1)  # Indicating 1 equality constraint

Jeff Reichman


-----Original Message-----
From: R-help <r-help-boun...@r-project.org> On Behalf Of
kol...@science.iwi.ac.at
Sent: Wednesday, July 30, 2025 2:32 PM
To: r-help@r-project.org
Subject: [R] Problem with function gp in package cccp

Dear all!

I tried to solve a simple test example of a geometric program:
minimize x + y   s.t.   xy = 1
The solution should be (1, 1).

I tried:
F0 <- diag(2)                  #  [m * n] m = number of terms of the
posynomial, n = number of variables
g0 <- log(matrix(1,2,1))       #  [m * 1]
A <-  matrix(c(1,1), 1, 2)     #  one constraint, one row
b <-  log(matrix(1,1,1))
RES <- gp(F0, g0, A=A, b=b)

Though I received the correct solution, the function gives a warning:
In gp(F0, g0, A = A, b = b) : No restrictions provided, trying solve().

Also, when I try
RES <- gp(F0, g0, A="A", b=b)
or
gp(F0, g0)

receiving the same result, I find out, that my equality constraints are not
considered at all.

In my view, the unconstraint problem should have (0, 0) as a solution, btw.

Am I missing something fundamental?

Thanks in advance!

Wolfgang
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to