Hello.
I am currently using minlp package from Alglib for Flux balance analysis. The problem is I am getting different values when compared to Alglib with Gurobi. Small model which containt only 19 equations return very close values. But for large-scale problems(~10K equations) the optimized values are completely different. Is it expected? Or am I missing something? Here are my codes and comparison for diffrent solvers.
Thanks!
Code:
alglib::sparsematrix A;
alglib::sparsecreate(real_row, real_col, A);
for (int i = 0; i < S_matrix.size(); i++)
{
{
// cout<<S_matrix[i][0]<<endl;
sparseset(A, S_matrix[i][0], S_matrix[i][1], S_matrix[i][2]);
}
}
// ALGLIB PARAMETERS
alglib::real_1d_array x;
alglib::minlpreport rep;
alglib::minlpstate state;
// SET LINEAR SOLVER
alglib::minlpcreate(real_col, state);
// OBJECTIVE FUNCTION
std::vector<double> f(real_col, 0);
f[13000] = -1;
alglib::real_1d_array C = "[]";
C.setcontent(real_col, f.data());
alglib::minlpsetcost(state, C);
// SET BOUNDS
alglib::real_1d_array bndl = "[]";
alglib::real_1d_array bndu = "[]";
for (int j = 0; j < reduced_reactions.size(); j++)
{
for (int i = 0; i < reduced_reactions[j].size(); i++)
{
if (reduced_reactions[0][i] == 0)
{
// cout<<reduced_reactions[0][i]<<endl;
lb[i] = 0;
ub[i] = 0;
}
}
auto start = std::chrono::steady_clock::now();
bndl.setcontent(real_col, lb.data());
bndu.setcontent(real_col, ub.data());
alglib::minlpsetbc(state, bndl, bndu);
// SET LINEAR CONSTRAINTS(all is '=' in this case)
std::vector<double> lower(real_row, 0);
std::vector<double> upper(real_row, 0);
// lower[3356] = 0.8;
// upper[3356] = 1;
alglib::real_1d_array d1 = "[]";
alglib::real_1d_array d2 = "[]";
vector<double> d_vec(real_row, 0);
d1.setcontent(real_row, d_vec.data());
d2.setcontent(real_row, d_vec.data());
//SCALING
std::vector<double> scale(real_col, 1);
scale[13000] = 1;
alglib::real_1d_array s = "[]";
s.setcontent(real_col, scale.data());
// minlpsetscale(state, s);
// minlpsetalgodss(state, 0.0000001);
// minlpsetalgoipm(state, 0.001);
alglib::minlpsetlc2(state, A, d1, d2, real_row);
// SOLVE
alglib::minlpoptimize(state);