Exemple #1
0
  bool AmplTNLP::apply_new_x(bool new_x, Index n, const Number* x)
  {
    DBG_START_METH("AmplTNLP::apply_new_x",
                   dbg_verbosity);

    ASL_pfgh* asl = asl_;
    DBG_ASSERT(asl_);

    if (new_x) {
      if (!hesset_called_) {
        call_hesset();
      }

      DBG_PRINT((1, "Set new x.\n"));
      // update the flags so these methods are called
      // before evaluating the hessian
      conval_called_with_current_x_ = false;
      objval_called_with_current_x_ = false;

      // tell ampl that we have a new x
      xknowne(const_cast<Number*>(x), (fint*)nerror_);
      return nerror_ok(nerror_);
    }

    return true;
  }
Exemple #2
0
static bool apply_new_x(CbcAmplInfo * info  , bool new_x, int  n, const double * x)
{
    ASL_pfgh* asl = info->asl_;

    if (new_x) {
        // update the flags so these methods are called
        // before evaluating the hessian
        info->conval_called_with_current_x_ = false;
        info->objval_called_with_current_x_ = false;
        info->jacval_called_with_current_x_ = false;

        //copy the data to the non_const_x_
        if (!info->non_const_x_) {
            info->non_const_x_ = new double [n];
        }

        for (int  i = 0; i < n; i++) {
            info->non_const_x_[i] = x[i];
        }

        // tell ampl that we have a new x
        xknowne(info->non_const_x_, (fint*)&info->nerror_);
        return info->nerror_ ? false : true;
    }

    return true;
}
Exemple #3
0
xknowe_(real *x, fint *nerror)
#endif
{
	ASL *asl;
	if (!(asl = cur_ASL))
		badasl_ASL(asl,0,"xknown");
	xknowne(x, nerror);
	}
Exemple #4
0
xknown_(real *x)
#endif
{
	ASL *asl;
	if (!(asl = cur_ASL))
		badasl_ASL(asl,0,"xknown");
	xknowne(x, (fint*)0);
	}