00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "CouenneOSInterface.hpp"
00013
00014 #include "CouenneProblem.hpp"
00015
00016 #include "CouenneTypes.hpp"
00017
00018 #include "CouenneExprSum.hpp"
00019 #include "CouenneExprMul.hpp"
00020 #include "CouenneExprClone.hpp"
00021 #include "CouenneExprGroup.hpp"
00022
00023 #include "BonTMINLP.hpp"
00024
00025
00026
00027
00028 namespace Bonmin {
00029
00030 class RegisteredOptions;
00031 class Bab;
00032 class TMINLP;
00033 }
00034
00035 using Ipopt::SmartPtr;
00036
00037 using namespace Couenne;
00038
00039 void CouenneOSInterface::registerOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions) {
00040 roptions->AddStringOption1("osilfile", "name of an osil file to read the problem instance from", "", "*", "name of osil file");
00041 }
00042
00043 CouenneOSInterface::~CouenneOSInterface() {
00044
00045 delete problem;
00046 }
00047
00048 CouenneProblem* CouenneOSInterface::getCouenneProblem() {
00049 if (!osinstance) {
00050
00051 }
00052
00053 problem = new CouenneProblem;
00054
00055
00056
00057
00058
00059
00060
00061
00062 int n_var = 0;
00063
00064
00065 for (int i = 0; i < n_var; i++)
00066 problem -> addVariable (false, problem -> domain ());
00067
00068
00069 expression *expr = NULL;
00070
00071 problem -> addObjective (expr, "min");
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083 CouNumber
00084 *x = (CouNumber *) malloc (n_var * sizeof (CouNumber)),
00085 *lb = (CouNumber *) malloc (n_var * sizeof (CouNumber)),
00086 *ub = (CouNumber *) malloc (n_var * sizeof (CouNumber));
00087
00088 for (int i = n_var; i--;) {
00089 x [i] = 0.;
00090 lb [i] = -COUENNE_INFINITY;
00091 ub [i] = COUENNE_INFINITY;
00092 }
00093
00094
00095 problem -> domain () -> push (n_var, x, lb, ub);
00096 free (x); free (lb); free (ub);
00097
00098
00099
00100
00101
00102
00103
00104
00105 for (register int i=n_var; i--;) {
00106 problem -> Lb (i) = - COUENNE_INFINITY;
00107 problem -> Ub (i) = COUENNE_INFINITY;
00108 problem -> X (i) = 0;
00109 }
00110
00111
00112
00113 return problem;
00114 }
00115
00116 Ipopt::SmartPtr<Bonmin::TMINLP> CouenneOSInterface::getTMINLP() {
00117 return tminlp;
00118 }
00119
00120 bool CouenneOSInterface::writeSolution(Bonmin::Bab& bab) {
00121
00122 return false;
00123 }