| 1 |
// (C) Copyright International Business Machines Corporation 2007 |
| 2 |
// All Rights Reserved. |
| 3 |
// This code is published under the Eclipse Public License. |
| 4 |
// |
| 5 |
// Authors : |
| 6 |
// Pierre Bonami, International Business Machines Corporation |
| 7 |
// |
| 8 |
// Date : 10/16/2007 |
| 9 |
#include "BonTMINLP2OsiLP.hpp" |
| 10 |
#include "BonTypes.hpp" |
| 11 |
#include "OsiSolverInterface.hpp" |
| 12 |
#include "BonTMINLP2TNLP.hpp" |
| 13 |
#include "CoinPackedMatrix.hpp" |
| 14 |
|
| 15 |
#include <vector> |
| 16 |
#include <sstream> |
| 17 |
#include <climits> |
| 18 |
|
| 19 |
using namespace Ipopt; |
| 20 |
|
| 21 |
namespace Bonmin { |
| 22 |
|
| 23 |
|
| 24 |
void |
| 25 |
TMINLP2OsiLP::initialize_jac_storage(){ |
| 26 |
assert(IsValid(model_)); |
| 27 |
int n; |
| 28 |
int m; |
| 29 |
int nnz_jac_g; |
| 30 |
int nnz_h_lag; |
| 31 |
TNLP::IndexStyleEnum index_style; |
| 32 |
//Get problem information |
| 33 |
model_->get_nlp_info( n, m, nnz_jac_g, nnz_h_lag, index_style); |
| 34 |
jCol_.resize(nnz_jac_g); |
| 35 |
iRow_.resize(nnz_jac_g); |
| 36 |
value_.resize(nnz_jac_g); |
| 37 |
|
| 38 |
model_->eval_jac_g(n, NULL, 0, m, nnz_jac_g, iRow_(), jCol_(), NULL); |
| 39 |
if(index_style == TNLP::FORTRAN_STYLE){ |
| 40 |
for(size_t i = 0 ; i < iRow_.size() ; i++){ |
| 41 |
iRow_[i]--; jCol_[i]--; |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
const_types_.resize(m); |
| 46 |
model_->get_constraints_linearity(m, const_types_()); |
| 47 |
|
| 48 |
} |
| 49 |
|
| 50 |
} |
| 51 |
|