help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

R: [Help-glpk] Re: cloning


From: Giampaolo Tomassoni
Subject: R: [Help-glpk] Re: cloning
Date: Sun, 13 May 2007 01:47:23 +0200

> Dear colleagues,
> 
> the GlpkSolver´s API is clonable, but its cloning process has
> failed, though I have used casting in glpk 4.8 java interface.
> I know that this list is not about glpk 4.8 java interface,
> but I need resolve my problem.

The GlpkSolver instance is not cloneable by its own since there is no
implementation of the clone() interface in the Glpk to Jni interface and the
GLPK API itself doesn't help in this: most of the data in the API's LPX
structure is allocated through malloc and its content is to be regarded as
"opaque" even to the JNI interface...

This being the case, a reliable clone() implementation could be developed
only iff the API would supply an equivalent C-language functionality, which
is instead missing.

As a work-around, have a Java class inherit the GlpkSolver one, then
override the clone() function and there:

        1) yield a new instance of the class, 
        2) fill it with the problem data fetched by the original GlpkSolver
instance

Since you probably know how your class of problems are constructed, you may
easily end up needing few things to be "copied" from the original instance
to the cloned one.

Once you got such a class, ever instance that in your application, not the
GlpkSolver one.

Giampaolo
 

>
> thank you very much
> ras
>
> 
> On 5/9/07, Ricardo Martins <address@hidden> wrote: 
>
> 
> Dear colleagues
> 
> how could I clone an object from GlpkSolver class using glpk
> 4.8 java interface?
> 
> I have received the following error:
> 
> glpk_teste13.java:214: clone() has protected access in
> java.lang.Object
> GlpkSolver solver2 = (GlpkSolver) solver.clone( );
>                     
> 
> best regards
> Ricardo Martins






reply via email to

[Prev in Thread] Current Thread [Next in Thread]