Skip to content

Commit

Permalink
Merge branch 'develop' into nlwpy
Browse files Browse the repository at this point in the history
  • Loading branch information
glebbelov committed Feb 22, 2024
2 parents b4d3137 + ff46d99 commit 0275be5
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,9 @@ if (BUILD_EXAMPLES OR NLW2_LIB)
# for a calling CMake project
set(NLW2_LIB_NAME ${NLW2_LIB_NAME} PARENT_SCOPE)
set(NLW2_C_API_LIB_NAME ${NLW2_C_API_LIB_NAME} PARENT_SCOPE)
# Add to folders to better organize project in IDEs
add_to_folder(${MP_FOLDER_PREFIX}nlw nlw2 nlw2_c_api nl-writer-example-c nl-writer-example-cpp)
add_to_folder(${MP_FOLDER_PREFIX}nlw gen_nl_opcodes nlw-ex-easy-api-c nlw-ex-easy-api-cpp nlw-ex-full-api-c nlw-ex-full-api-cpp)
endif()


Expand Down
4 changes: 4 additions & 0 deletions solvers/gcgmp/CHANGES.gcgmp.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Summary of recent updates to GCG for AMPL
=========================================

## 20240221
- Updated to GCG 400


## 20240115
- *Solve result codes*.
- List codes by running (solver) -!
Expand Down
4 changes: 4 additions & 0 deletions solvers/scipmp/CHANGES.scipmp.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Summary of recent updates to SCIP for AMPL
==========================================


## 20240221
- Updated to SCIP 9.0


## 20240121
- Updated to SCIP 8.1.0

Expand Down
13 changes: 8 additions & 5 deletions test/end2end/scripts/python/BenchmarkExporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,14 @@ def getModelsStats(self, run):
return [ stats["nvars"], stats["nintvars"], stats["nconstr"], stats["nnz"]]

def getStyle(self, r):
if "solved" in r[-1]["timelimit"]:
return None
elif "limit" in r[-1]["timelimit"]:
return self.font_yellow
else:
try:
if "solved" in r[-1]["timelimit"]:
return None
elif "limit" in r[-1]["timelimit"]:
return self.font_yellow
else:
return self.font_red
except:
return self.font_red

def writeLastResultLine(self, mr: ModelRunner):
Expand Down
45 changes: 45 additions & 0 deletions test/end2end/scripts/python/Solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,51 @@ def _doParseSolution(self, st, stdout=None):
except:
print("No solution, string: {}".format(n))
self._stats["objective"] = None


class ConoptSolver(AMPLSolver):

def _setLPMethod(self, method : str):
return ""

def _setTimeLimit(self, seconds):
return "maxftime={}".format(seconds)

def _setNThreads(self, threads):
return ""

def _getAMPLOptionsName(self):
return "conopt"

def __init__(self, exeName, timeout=None, nthreads=None, otherOptions=None):
stags = {ModelTags.continuous, ModelTags.integer, ModelTags.binary,
ModelTags.linear,
ModelTags.plinear,
ModelTags.quadratic,
ModelTags.quadratic_obj,
ModelTags.quadraticnonconvex,

ModelTags.socp,
ModelTags.socp_hard_to_recognize,
ModelTags.nonlinear, ModelTags.log, ModelTags.trigonometric}

super().__init__(exeName, timeout, nthreads, otherOptions, stags)

def _doParseSolution(self, st, stdout=None):
if not st:
self._stats["outmsg"] = "Solution file empty"
self._stats["timelimit"] = False
return None
self._stats["outmsg"] = st[0]
self._stats["timelimit"] = "time limit" in st[0]
tag = "Objective "
if tag in st[1]:
n = st[1][st[1].index(tag) + len(tag):]
try:
self._stats["objective"] = float(n)
except:
print("No solution, string: {}".format(n))
self._stats["objective"] = None

class OcteractSolver(AMPLSolver):
def __init__(self, exeName, timeout=None, nthreads=None, otherOptions=None):
Expand Down
2 changes: 2 additions & 0 deletions test/end2end/scripts/python/SolverCollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def addStdSolvers(solvers: SolverCollection, binPath=""):
solvers.addSolver(Solver.CPLEXSolver(path.join(binPath,"cplex")))
solvers.addSolver(Solver.CPLEXDirectSolver(path.join(binPath,"cplexmp"))) ## Need as long as the target is there
solvers.addSolver(Solver.BaronSolver(path.join(binPath,"baron")))
solvers.addSolver(Solver.ConoptSolver(path.join(binPath,"conopt4")))
solvers.addSolver(Solver.ConoptSolver(path.join(binPath,"conopt")))
solvers.addSolver(Solver.COPTSolver(path.join(binPath,"copt")))
solvers.addSolver(Solver.MindoptSolver(path.join(binPath,"mindoptampl")))
solvers.addSolver(Solver.HighsSolver(path.join(binPath,"highs")))
Expand Down

0 comments on commit 0275be5

Please sign in to comment.