CPLEX OPL Error 5002: Constraint not convex - constraints

I'm trying to work with cplex opl and facing an error. I read the manual and googled but I still have no idea what I should do to fix this error due to my lacking of knowledge. Can anyone please help or give me ideas to figure this out? I really need your help.
I am programming a mixed-integer-programming model. I ran the configuration and get this error:
Error 5002: 'NachfrageAusZUgeordnetenDZs#0#0' is not convex
Here is the code of the constraint:
constraint
Can someone tell my why I get this error? Why is the constraint not convex? And how can I change it to make it work?
Thanks in advance for your time and effort!

Your constraint is not convex. You could try to get not convex part in your objective and then rely on
https://www.ibm.com/support/knowledgecenter/SSSA5P_12.7.1/ilog.odms.cplex.help/CPLEX/Parameters/topics/OptimalityTarget.html
Or you could also try some linearization methods. See:
https://www.ibm.com/developerworks/community/forums/html/topic?id=f48c280e-144b-46aa-abb9-906a4eb4219f&ps=25

Related

Error: ebirdst::calc_full_extent() function does not exist

I am trying to use the ebirdst package for some exploratory data analysis, following this tutorial. Everything going according to plan until I run this line:
week_ext <- calc_full_extent(occ_proj)
and get this error:
Error in calc_full_extent(occ_proj) : could not find function "calc_full_extent"
I know sometimes new functions won't show up, or it can be a version issue, but the tutorial I'm referencing is from 2018 and everything else works perfectly. Does anyone know why a crucial function would just not be there? Or what steps to take? I've looked to see if there are any analogous functions and can't find any.
Also this is my first stackoverflow question--I've always been able to solve my issues based on existing questions, but there seems to be very little out there on ebirdst--so please let me know if I need to provide more info/context.
Thanks!

Can not find function fix.dta

I am trying to follow the code set out in camera trapping for wildlife research, using my own data. I am trying to use the function fix.dta(). I am getting the error message error in fix.dta, could not find function fix.dta. I have tried googling the function but can not find anything about it at all. I was hoping someone may know how to help?
Many thanks
.dta is a file extension for stata files. Maybe you mean fix.data() function.

Is there a way to define a current quarter in R?

I have written a small program in R, and when I get to this following line:
i=which(grepl(yyyy.q, Metrop$year))+1
I get the following error message:
Error in grepl(yyyy.q, Metrop$year) : object 'yyyy.q' not found
I think maybe this is occurring because I haven't defined 2019.3 as the current "yyyy.q". And that is what I need to do in order to tell R to start forecasting according to my model. Does that seem like the likely problem? I thought that was the problem but have struggled to fix it.
Here is how I am defining things in the beginning of my program before I get to the actual model specification, I assume the full code isn't necessary, but happy to share if that helps.
Metrop<-Houston
name<-"National"
Metrop<-Metrop[Metrop$year>=1989.4,]
Screenshot of dataset
Thanks for you help. Happy to share any more code or data if necessary.

Is there a function in the package lpsolve/lpsolveAPI that is able to remove constraints not met (in case of infeasibility)?

I am using the packages lpSolve and lpSolveAPI in R for linear programmation.
I end up with infeasible models. So, I would like to know if there exists a function that finds the constraints that are not met and that tests with differents set of constraints to get a feasible model.
I have looked at the lpSolveAPI documentation (https://cran.r-project.org/web/packages/lpSolveAPI/lpSolveAPI.pdf) and I wonder if the lp.control.options could help me, but I do not understand the provided explainations.
Plus, I can't do it manually because I have too many constraints.
Thanks if someone understood my problem and could help me.

Configuring SOCP solver in 'R'

I am trying to use the Rsocp package in R to solve a linear optimization problem with quadratic constraints. Much like in R - fPortfolio - Error in eqsumW[2, -1] : subscript out of bounds
More specifically I am attempting to maximize an expected return given a target risk parameter and portfolio/position limits.
install.packages("Rsocp", repos="http://R-Forge.R-project.org")
install.packages("fPortfolio")
require(fPortfolio)
require(Rsocp)
I run
lppData=100*LPP2005.RET[,1:6]
maxRetSpec=portfolioSpec()
setTargetRisk(maxRetSpec)=0.07
groupConstraints <- c("minsumW[1:6]=-.75",
"maxsumW[1:6]=1.75")
boxConstraints <- c("minW[1:6]=-1",
"maxW[1:6]=1")
bgConstraints <- c(groupConstraints, boxConstraints)
setSolver(maxRetSpec)="solveRsocp"
efficientPortfolio(data=lppData, spec=maxRetSpec, constraints=bgConstraints)
and get the following error...
Error in eqsumW[2, -1] : subscript out of bounds
It is my understand that Rsocp is a second order cone solver designed specifically for this purpose. Having gone through several different stackexchange forums it seems there are several people who have encountered this problem with unsatisfactory solutions. I was wondering if anyone has had success using the Rsocp solver that could give me a hand working through this error? Or alternatively can someone point me towards an 'R' solver that can handle this type of optimization problem?

Resources