Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: cmex problem (lp_solve) with solaris 2.5
Replies: 0

 saurabh thapliyal Posts: 9 Registered: 12/7/04
cmex problem (lp_solve) with solaris 2.5
Posted: Jul 16, 1996 8:43 PM

Hi,

I'm with Dr. Kantor's group at Notre Dame (process control) and we had
written a cmex file (for SunOS4.1.3) for a popular linear program
solver,
lp_solve, which was made available publically.

We are now trying to make it work for MATLAB4.2c under solaris 2.5.

The C code compiles and runs fine by itself in solaris, the .mexsol
cmex file is also compiled without any problems, and it even works ok
for
all of its segments, except one part. i.e. we can input and output
parameters
to and from the C file to MATLAB, make a lp, scale it,
add constraints etc., but when we try to solve it, we get a MATLAB bus
error.

I would appreciate it if someone could provide some suggestions, when
bus errors occur, or if someone has had similar experiences with MATLAb
under solaris 2.5 (since the mathworks does not yet support matlab 4.2c
under this solaris version)

thanks very much,

saurabh

----------------------------------

Here's an example of the above problem :

>> f = [-1 2]';
>> A = [2 1;-4 4];
>> b = [5 5];
>> e = -[1 1];
>> xint = [1 2];

this is the LP input part, it works fine :

>> [m,n] = size(a);
>> lp = lpmex('make_lp',m,n);
>> lpmex('set_mat', lp, a);
>> lpmex('set_rh_vec', lp, b);
>> lpmex('set_obj_fn', lp, f);
>> lpmex('set_maxim', lp); % default is solving minimum lp.
>>
>> for i = 1:length(e)

lpmex('set_constr_type', lp, i,e(i)+1);
end
>> >> for i = 1:length(xint)
lpmex('set_int', lp,xint(i),1);
end

We can also output the LP back into MATLAB :

>> lpmex('print_handle')

ans =

0
1

>> lpmex('print_lp',0)
problem name: unnamed
Var[ 1] Var[ 2]
Maximise -1.00 2.00
Row[ 1] 2.00 1.00 <= 5.00
Row[ 2] -4.00 4.00 <= 5.00
Type Int Int
upbo Inf Inf
lowbo 0.00 0.00

But when we try to solve :

>> lpmex('solve',0)

------------------------------------------------------------------------
MATLAB bus error detected !!!
------------------------------------------------------------------------

Please report this problem to The MathWorks if you can replicate it.
We need as much information as you can provide! Please include at least
the following:

1. MATLAB version number
2. Platform type, Operating System and Window System versions
3. Sample commands, M-files, or MEX-files that reproduce the error
4. Any other pertinent configuration information

Either E-mail the information to:

support@mathworks.com

or FAX this information to:

508-653-2997.

Try to save your workspace and quit.
Error in ==> /afs/nd.edu/user13/sthapliy/LP_SOLVE/lpmex.mexsol