m_problem "problem"

7 views
Skip to first unread message

sferrera

unread,
Dec 9, 2010, 10:57:21 AM12/9/10
to csipopt
Dear Anders,
I have a problem with the minimization.

Like I said in one of the mails, I am using vector_double (GSLDLL)
instead double[] that's because the primary calculation engine of my
project uses that type of data.

So, I created a new constructor:

public Ipopt(int n, vector_double x_L, vector_double x_U, int m,
vector_double g_L, vector_double g_U, int nele_jac, int nele_hess,
EvaluateObjectiveDelegate eval_f, EvaluateConstraintsDelegate eval_g,
EvaluateObjectiveGradientDelegate eval_grad_f,
EvaluateJacobianDelegate eval_jac_g, EvaluateHessianDelegate eval_h)

and I have a function that transform the vector_double into double[]:

dbl_x_L = ConvertType(x_L);
etc..

once that operation is done I continue with the regular steps:
unsafe
{
fixed (double* p_x_L = dbl_x_L, p_x_U = dbl_x_U, p_g_L = dbl_g_L,
p_g_U = dbl_g_U)
{
m_eval_f = new ObjectiveEvaluator(eval_f).Evaluate;
m_eval_g = new ConstraintsEvaluator(eval_g).Evaluate;
m_eval_grad_f = new
ObjectiveGradientEvaluator(eval_grad_f).Evaluate;
m_eval_jac_g = new JacobianEvaluator(eval_jac_g).Evaluate;
m_eval_h = new HessianEvaluator(eval_h).Evaluate;

m_problem = CreateIpoptProblem(n, p_x_L, p_x_U, m, p_g_L,
p_g_U, nele_jac, nele_hess, 0,
m_eval_f, m_eval_g, m_eval_grad_f,
m_eval_jac_g, m_eval_h);

if (m_problem == IntPtr.Zero)
{
throw new ArgumentException("Failed to initialize IPOPT
problem");
}
}
}
m_disposed = false;

somehow, with the same values of your example, exactly the same, the
result on m_problem is diferent and I assume that changes the final
result of the minimization because when I ran the program with
double[] dbl_x = { 1.0, 5.0, 5.0, 1.0 } the minimization result is
diferent than vector_double = { 1.0, 5.0, 5.0, 1.0 }

Am I do something wrong?

PS: the others functions also have the ConvertType, I check this
function and passes the values ok.




sferrera

unread,
Dec 9, 2010, 1:36:12 PM12/9/10
to csipopt
already fixed.

Anders

unread,
Dec 9, 2010, 4:19:08 PM12/9/10
to csipopt
Dear Sebastian,

glad to hear you have fixed the problem. If the error was in the
csipopt code, I'd be happy to read more about the error and its
solution.

Regards,
Anders

sferrera

unread,
Dec 10, 2010, 7:14:26 AM12/10/10
to csipopt
The problem wasn't csipopt, was my mistake... when
problem.SolveProblem is called I pass a vector_double and in the
function I have a convertion for double[], after that, when I go to
print the minimization result I am doing it with the original
vector_double, but that is not valid because in SolveProblem I used a
double[]

Hope you understand.

Regards,

Sebastian.
Reply all
Reply to author
Forward
0 new messages