Skip to content

Commit

Permalink
fix minor warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilles Chabert committed May 19, 2019
1 parent 9f0e763 commit e6dbc4b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions plugins/optim/src/loup/ibex_LoupFinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ bool LoupFinder::check(const System& sys, const Vector& pt, double& loup, bool _

void LoupFinder::monotonicity_analysis(const System& sys, IntervalVector& box, bool is_inner) {

int n=sys.nb_var;
size_t n=sys.nb_var;

if (!is_inner && sys.f_ctrs.used_vars.size()==n)
// if there is no inner box and all the variables appear
Expand All @@ -56,7 +56,7 @@ void LoupFinder::monotonicity_analysis(const System& sys, IntervalVector& box, b
IntervalVector g(n);
sys.goal->gradient(box,g);

for (int j=0; j<n; j++) {
for (size_t j=0; j<n; j++) {
if (is_inner || !sys.f_ctrs.used(j)) {
if (g[j].lb()>=0 && box[j].lb()!=NEG_INFINITY) box[j]=box[j].lb();
if (g[j].ub()<=0 && box[j].ub()!=POS_INFINITY) box[j]=box[j].ub();
Expand Down
4 changes: 2 additions & 2 deletions plugins/optim/src/loup/ibex_LoupFinderDuality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ std::pair<IntervalVector, double> LoupFinderDuality::find(const IntervalVector&

Vector goal=igoal.mid();

int j=0;
for (; j<n; j++)
size_t j=0;
for (; j<(size_t) n; j++)
lp_solver.set_obj_var(j,goal[j]);
for (; j<nb_LP_var; j++)
lp_solver.set_obj_var(j,0);
Expand Down
3 changes: 2 additions & 1 deletion plugins/optim/src/loup/ibex_LoupFinderInHC4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ std::pair<IntervalVector, double> LoupFinderInHC4::find(const IntervalVector& bo
if (c==goal_ctr) // ---> f(x)<=y
right_cst=Interval::neg_reals();
else
right_cst=Interval::zero(); break;
right_cst=Interval::zero();
break;
case GEQ :
case GT : right_cst=Interval::pos_reals(); break;
}
Expand Down
3 changes: 2 additions & 1 deletion plugins/optim/src/loup/ibex_LoupFinderProbing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ std::pair<IntervalVector, double> LoupFinderProbing::find(const IntervalVector&
// we activate line probing only if the starting point has improved the goal.
// we use the full box (not inbox)
line_probing(loup_point, loup, box);
else if (!current_loup_point.is_empty())
else if (!current_loup_point.is_empty()) {
// Try Hansen dichotomy between the last candidate point (pt)
// and the loup (note: the segment goes outside of the box, this is on purpose).
//
// Possible improvement: chose the random point with the smallest criterion
// instead of the last one.
loup_point = current_loup_point.lb();
loup_changed = dichotomic_line_search(loup_point, loup, pt,true);
}
}

/*========================================================*/
Expand Down
3 changes: 2 additions & 1 deletion src/data/ibex_CovManifold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ CovManifold::CovManifold(size_t n, size_t m, size_t nb_ineq, BoundaryType bounda
data->_manifold_nb_ineq = nb_ineq;
data->_manifold_boundary_type = boundary_type;

if (n>0) // if well initialized
if (n>0) { // if well initialized
// create once for all varset structure for variables and parameters
if (m==0)
data->_manifold_solution_varset.push_back(VarSet(n,BitSet::all(n),false)); // all parameters
else if (m==n)
data->_manifold_solution_varset.push_back(VarSet(n,BitSet::empty(n),false)); // no parameter
}
}

CovManifold::CovManifold(const char* filename) : CovManifold(0,0,0 /* tmp */, EQU_ONLY /* by default */) {
Expand Down
4 changes: 2 additions & 2 deletions src/numeric/ibex_LinearizerDuality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ int LinearizerDuality::linearize(const IntervalVector& box, LPSolver& lp_solver,
for (BitSet::iterator c=active->begin(); c!=active->end(); ++c, i++) {

if (!sys.f_ctrs.deriv_calculator().is_linear[c]) {
for (int j=0; j<n; j++) {
for (size_t j=0; j<n; j++) {
Vector row(n_total,0.0);
row[j]=1;
row[n + c*n +j]=1;
Expand All @@ -97,7 +97,7 @@ int LinearizerDuality::linearize(const IntervalVector& box, LPSolver& lp_solver,

Vector diam_correctly_rounded = (IntervalVector(J[i].ub())-gl).lb();

for (int j=0; j<n; j++) {
for (size_t j=0; j<n; j++) {
if (diam_correctly_rounded[j]<0)
ibex_error("negative diameter");
}
Expand Down

0 comments on commit e6dbc4b

Please sign in to comment.