Skip to content

Commit

Permalink
xy>=1 as rotated cone #192
Browse files Browse the repository at this point in the history
  • Loading branch information
glebbelov committed May 29, 2023
1 parent d0e4b86 commit cbef5c5
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGES.mp.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Summary of recent updates to the AMPL MP Library
================================================


## TBD
- Cones: recognize xy >= 1 as rotated SOC.


## 20230515
- *Recognize exponential conic constraints*.
Exponential cones are recognized and passed to the
Expand Down
6 changes: 3 additions & 3 deletions include/mp/flat/redef/conic/cones.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,10 @@ class Convert1QC : public MCKeeper<MCType> {
if (fND1 && qptt.coef12*sens<0.0)
return false;
if ((sens>0 &&
qptt.nSamePos==0 && qptt.nSameNeg)
qptt.nSamePos==0)
||
(sens<0 &&
qptt.nSameNeg==0 && qptt.nSamePos))
qptt.nSameNeg==0))
return AddRotatedQC(qpterms, lint, rhs,
qptt.iDiffVars);
}
Expand Down Expand Up @@ -518,7 +518,7 @@ class Convert1QC : public MCKeeper<MCType> {
bool AddRotatedQC(const QuadTerms& qpterms,
const LinTerms& lint,
double rhs, int iDiffVars) {
assert(lint.size() + (iDiffVars>=0) == 1);
assert(lint.size() + (iDiffVars>=0) <= 1);
const auto rhsNon0 = (std::fabs(rhs)!=0.0);
std::vector<int> x(qpterms.size()+1+lint.size()+rhsNon0);
std::vector<double> c(qpterms.size()+1+lint.size()+rhsNon0);
Expand Down
8 changes: 8 additions & 0 deletions test/end2end/cases/categorized/fast/conic/modellist.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@
"objective" : 11.42915114,
"tags" : ["socp"]
},
{
"name" : "socp_09_rsoc_hyperb_eoq",
"tags" : ["socp"],
"values": {
"x": 3651.48
},
"comment": "Obj values are strangely different among solvers..."
},
{
"name" : "expcones_01__plain",
"objective" : 0.7821882953,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Economic order quantity
## MO-Book https://github.com/mobook/MO-book

param h default 0.75; # cost of holding one item for one year
param c default 500; # cost of processing one order
param d default 10000; # annual demand

# define variables for conic constraints
var x >= 0;
var y >= 0;

# conic constraint
s.t. q:
x*y >= 1;

# linear objective
minimize eoq:
h*x/2 + c*d*y;

0 comments on commit cbef5c5

Please sign in to comment.