37#ifndef __SCIP_PARA_INSTANCE_MPI_H__
38#define __SCIP_PARA_INSTANCE_MPI_H__
82 if( method == 2 && SCIPgetStage(
scip) != SCIP_STAGE_SOLVED )
85 SCIP_Bool success = TRUE;
86 SCIP_CALL_ABORT( SCIPcreate(&tempScip) );
89 #if SCIP_VERSION == 211 && SCIP_SUBVERSION == 0
90 SCIP_CALL_ABORT( SCIPcopyPlugins(
scip, tempScip, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
91 TRUE, TRUE, TRUE, TRUE, &success) );
93 #if SCIP_APIVERSION >= 100
94 #if SCIP_APIVERSION >= 101
95 SCIP_CALL_ABORT( SCIPcopyPlugins(
scip, tempScip, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
96 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, &success) );
98 SCIP_CALL_ABORT( SCIPcopyPlugins(
scip, tempScip, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
99 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, &success) );
101 #elif SCIP_APIVERSION >= 17
102 SCIP_CALL_ABORT( SCIPcopyPlugins(
scip, tempScip, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
103 TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, &success) );
105 SCIP_CALL_ABORT( SCIPcopyPlugins(
scip, tempScip, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
106 TRUE, TRUE, TRUE, TRUE, FALSE, &success) );
109 SCIP_CALL_ABORT( SCIPcopyParamSettings(
scip, tempScip) );
112 SCIP_HASHMAP* varmap = 0;
113 if( SCIPgetNVars(
scip) > 0 )
115 SCIP_CALL_ABORT( SCIPhashmapCreate(&varmap, SCIPblkmem(tempScip), SCIPgetNVars(
scip)) );
117 SCIP_HASHMAP* conssmap = 0;
118 if( SCIPgetNConss(
scip) > 0 )
120 SCIP_CALL_ABORT( SCIPhashmapCreate(&conssmap, SCIPblkmem(tempScip), SCIPgetNConss(
scip)) );
124 SCIP_CALL_ABORT( SCIPcopyProb(
scip, tempScip, varmap, conssmap, TRUE,
"") );
128 if( SCIPgetNVars(
scip) > 0 )
130#if (SCIP_VERSION < 321 || ( SCIP_VERSION == 321 && SCIP_SUBVERSION < 2) )
131 SCIP_CALL_ABORT( SCIPcopyVars(
scip, tempScip, varmap, conssmap, TRUE) );
133 SCIP_CALL_ABORT( SCIPcopyVars(
scip, tempScip, varmap, conssmap, NULL, NULL, 0, TRUE) );
136 if( SCIPgetNConss(
scip) > 0 )
138 SCIP_CALL_ABORT( SCIPcopyConss(
scip, tempScip, varmap, conssmap, TRUE, FALSE, &success) );
141#if SCIP_APIVERSION > 39
147 SCIP_CALL_ABORT( SCIPcopyBenders(
scip, tempScip, NULL, TRUE, &valid) );
153 if( SCIPgetNConss(
scip) > 0 )
155 SCIPhashmapFree(&conssmap);
157 if( SCIPgetNVars(
scip) > 0 )
159 SCIPhashmapFree(&varmap);
162 std::cerr <<
"Some constraint handler did not perform a valid copy. Cannot solve this instance." << std::endl;
168 int n = SCIPgetNVars(tempScip);
173 if( SCIPgetNConss(
scip) > 0 )
175 SCIPhashmapFree(&conssmap);
177 if( SCIPgetNVars(
scip) > 0 )
179 SCIPhashmapFree(&varmap);
184 std::cout <<
"** ParaScipInstance copy does not increase the number of variables. **" << std::endl;
189 std::cout <<
"** ParaScipInstance copy increased the number of variables. **" << std::endl;
237 for(
int v = 0; v <
nVars; ++v)
240 objCoefs[v] = SCIPvarGetObj(vars[v]);
241 assert(SCIPvarGetProbindex(vars[v])!=-1);
242 assert(SCIPvarGetProbindex(vars[v]) == v);
243 lVarNames += strlen(SCIPvarGetName(vars[v])) + 1;
249 for(
int v = 0; v <
nVars; ++v )
251 SCIP_VAR *var = vars[v];
253 varLbs[SCIPvarGetProbindex(var)] = SCIPvarGetLbLocal(var);
254 varUbs[SCIPvarGetProbindex(var)] = SCIPvarGetUbLocal(var);
255 varTypes[SCIPvarGetProbindex(var)] = SCIPvarGetType(var);
bool isCopyIncreasedVariables()
MPI_Datatype createDatatype3(bool memAllocNecessary)
ScipParaInstanceMpi(SCIP *scip, int method)
void allocateMemoryForDatatype3()
void copyIncrasedVariables()
const char * getFileName()
MPI_Datatype createDatatype2(bool memAllocNecessary)
int bcast(UG::ParaComm *comm, int rank, int method)
void setFileName(const char *inFileName)
void allocateMemoryForDatatype2()
MPI_Datatype createDatatype1()
void copyScipEnvironment(SCIP **scip)
bool copyIncreasedVariables
Base class of communicator object.
static ScipParaCommTh * comm
ScipParaInstanceMpi * ScipParaInstanceMpiPtr
Base class of communicator for UG Framework.
Defines for UG Framework.
ParaInstance extenstion for SCIP solver.