-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* init scip solver driver * minimal driver * add basic functionalities * fix primal solution * change getPROBDATA to cons * change getPROBDATA v2 * fix test * add indicator constraint LinLE * add indicator constraint LinGE * add indicator constraint LinEQ * change indicator constraint to recommended * add or, and constraint * handle char and bool param * add more options * improve readme and changes * disable sepa of indicator cons * improve memory handling * add linearHelper method * add indicator helper method * add quadratic helper method * add pool solution * add abs, sin and cosfunctions * add exp and log function * add pow function * add more options and concurrent mode * improve tests * add more options * add last options * adapt mipstart header * Update CHANGES.scip.md * add option to x-multimip1 * change cmake
- Loading branch information
1 parent
bdec071
commit 5ecade4
Showing
22 changed files
with
2,122 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Summary of recent updates to SCIP for AMPL | ||
========================================== | ||
|
||
## Unreleased | ||
- First release of mock driver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
SCIP driver for AMPL | ||
==================== | ||
|
||
SCIP (Solving Constraint Integer Programs) is currently one of the | ||
fastest non-commercial solvers for mixed integer programming (MIP) | ||
and mixed integer nonlinear programming (MINLP). It is also a framework | ||
for constraint integer programming and branch-cut-and-price. | ||
More information can be found in https://scipopt.org/#scipoptsuite. | ||
|
||
Normally SCIP is invoked by AMPL's solve command, which gives the | ||
invocation | ||
|
||
scip stub -AMPL | ||
|
||
in which stub.nl is an AMPL generic output file (possibly written | ||
by "ampl -obstub" or "ampl -ogstub"). After solving the problem, | ||
scip writes a stub.sol file for use by AMPL's solve and solution | ||
commands. When you run ampl, this all happens automatically if you | ||
give the AMPL commands | ||
|
||
option solver scip; | ||
solve; | ||
|
||
You can control scip either by setting the environment variable | ||
scip_options appropriately (either by using ampl's option command, | ||
or by using the shell's set and export commands before you invoke ampl), | ||
or by passing the options on the command line: | ||
|
||
scip stub [-AMPL] option1=value option2=value ... | ||
|
||
You can put one or more (white-space separated) phrases in $scip_options. | ||
To see the possibilities, invoke | ||
|
||
scip -= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "mp/backend-app.h" | ||
|
||
/// Declare a backend factory | ||
std::unique_ptr<mp::BasicBackend> CreateScipBackend(); | ||
|
||
extern "C" int main1(int, char **argv) { | ||
return | ||
mp::RunBackendApp(argv, CreateScipBackend); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* Generate ModelManagerWithPB<mp::Problem> | ||
* | ||
* Having a separate .cc should improve compilation speed | ||
*/ | ||
|
||
#include "mp/model-mgr-with-std-pb.hpp" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#ifndef SCIPAMPLSCAPI_H | ||
#define SCIPAMPLSCAPI_H | ||
/* | ||
* C API for MP/Scip | ||
*/ | ||
|
||
//#include "scip.h" | ||
|
||
#include "mp/ampls-c-api.h" | ||
|
||
/* | ||
* Below are Scip-specific AMPLS API functions. | ||
* They complement the 'public' AMPLS API defined in ampls-c-api.h. | ||
*/ | ||
|
||
/// Initialize AMPLS scip. | ||
|
||
/// @param slv_opt: a string of solver options | ||
/// (normally provided in the <solver>_options string). | ||
/// Can be NULL. | ||
/// @return pointer to struct AMPLS_MP_Solver to be populated. | ||
void* AMPLSOpenScip(const char* slv_opt, CCallbacks cb); | ||
|
||
/// Shut down solver instance | ||
void AMPLSCloseScip(AMPLS_MP_Solver* slv); | ||
|
||
/// Extract the Scip model handle | ||
void* GetScipmodel(AMPLS_MP_Solver* slv); | ||
|
||
|
||
#endif // SCIPAMPLSCAPI_H | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "scip/scip-ampls-c-api.h" | ||
|
||
#ifdef _WIN32 | ||
#define APIEXPORT __declspec(dllexport) | ||
#else | ||
#define APIEXPORT __attribute__((visibility("default"))) | ||
#endif | ||
|
||
|
||
APIEXPORT void* AMPLloadmodel(int argc, char** argv, CCallbacks cb) { | ||
const char* nl_filename = argv[1]; | ||
const char *slv_opt= argv[2]; | ||
AMPLS_MP_Solver* slv; | ||
slv = AMPLSOpenScip(slv_opt, cb); | ||
if (!slv) | ||
return NULL; | ||
AMPLSLoadNLModel(slv, nl_filename); | ||
return slv; | ||
} | ||
APIEXPORT void* AMPLgetScipmodel(void* slv) { | ||
return GetScipmodel(slv); | ||
} | ||
|
||
APIEXPORT void AMPLwritesolution(AMPLS_MP_Solver* slv, const char* solFileName) { | ||
AMPLSReportResults(slv, solFileName); | ||
} | ||
|
||
APIEXPORT void AMPLclosesolver(AMPLS_MP_Solver* slv) { | ||
AMPLSCloseScip(slv); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include "mp/flat/redef/MIP/converter_mip.h" | ||
#include "mp/flat/model_api_connect.h" | ||
|
||
#include "scipmodelapi.h" | ||
|
||
|
||
namespace mp { | ||
|
||
/// Defining the function in ...-modelapi-connect.cc | ||
/// for recompilation speed | ||
std::unique_ptr<BasicModelManager> | ||
CreateScipModelMgr(ScipCommon& cc, Env& e, | ||
pre::BasicValuePresolver*& pPre) { | ||
return CreateModelMgrWithFlatConverter< | ||
ScipModelAPI, MIPFlatConverter >(cc, e, pPre); | ||
} | ||
|
||
} // namespace mp |
Oops, something went wrong.