generating .sol files

46 views
Skip to first unread message

Ivet Galabova

unread,
Mar 15, 2015, 3:58:43 AM3/15/15
to am...@googlegroups.com
Hi,

I have a nonlinear solver written Fortran 77 and I'm writing an interface to AMPL in C. I generate a .sol file with

write_soln(char* msg, double* x, NULL);

the values of x that I pass are correct. When called form AMPL the msg gets printed but then I get

exit code 1
<BREAK>

with solve_exitcode 256.

when I type 

"display x;"

it will display the starting point. The .sol file looks like

optimal solution found.
0 iteraions, 88.200000 objective

Options
3
0
1
0
4
0
8
8
0
0
0
0
46.67
0
0
0

For comparison the .sol file generated by Minos for the same problem is

MINOS 5.51: optimal solution found.
6 iterations, objective 88.2

Options
3
0
1
0
4
4
8
8
0.0018181818181818108
0.008181818181818278
0.11599999999999991
-8.169327588411304e-18
0
0
0
0
46.66666666666666
1.5761812194954111e-15
8.429823983987501e-15
0
objno 0 0
suffix 0 8 8 0 0
sstatus
0 3
1 3
2 3
3 3
4 1
5 1
6 1
7 3
suffix 1 4 8 0 0
sstatus
0 3
1 3
2 3
3 1

Could you please tell me what am I doing wrong?

Any help is much appreciated!
Thanks in advance
Ivet

Ivet Galabova

unread,
Mar 15, 2015, 4:22:16 AM3/15/15
to am...@googlegroups.com
I've got

double xArray[n_var]; and call

write_soln(buffer , &xArray, NULL) ;

when I compile the solver I also get

filter.c:243: warning: passing argument 3 of ‘write_sol_ASL’ from incompatible pointer type
asl.h:1067: note: expected ‘double *’ but argument is of type ‘double (*)[(long unsigned int)(asl->i.n_var_)]’

victor.z...@gmail.com

unread,
Mar 16, 2015, 5:16:07 PM3/16/15
to am...@googlegroups.com
You should pass xArray instead of its address to write_soln (that's what compiler is complaining about):

  write_soln(buffer, xArray, NULL);

HTH,
Victor

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at http://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages