Re: [Scilab-users] Scilab control after an impossible calculation

2016-10-06 Thread Tim Wescott
For that matter, you can pass a vector of infemums and supremums for
each element of the vector you're optimizing.  (and +inf and -inf work,
for things that don't matter).  As long as you can optimize within a
rectilinear space then you can easily dodge the "bad" values.  It's in
the help for optim.

On Thu, 2016-10-06 at 13:12 +0200, Serge Steer wrote:
> If you use optim you can  set the ind retured arg to -1 in the cost
> function to say that the function cannot be evaluated at this point.
> 
> Serge
> 
> Le 06/10/2016 à 10:51, paul.carr...@free.fr a écrit :
> 
> > Hi All
> > 
> >  
> > 
> > I’m using Scilab as the interface between my optimizer and my finite
> > element solver(s) and sometimes Scilab stops because of unexpected
> > and impossible calculus (1/x with x = 0 as an example ); obviously
> > Scilab stops (and so the optimization).
> > 
> >  
> > 
> > I’m wondering if it’s possible:
> > 
> > -  To ask back Scilab a message such as “hey I crashed
> > because you’re a fool and you’ve not anticipated an impossible
> > calculation !!!”
> > 
> > -  To get back Scilab control in order to avoid optimization
> > process crash ? I’ve been thinking in affecting a cost function
> > value at %inf for example (not elegant I recognize)
> > 
> >  
> > 
> > I don’t know if I’m understandable enough …
> > 
> >  
> > 
> > Paul
> > 
> > 
> > 
> > 
> > ___
> > users mailing list
> > users@lists.scilab.org
> > http://lists.scilab.org/mailman/listinfo/users
> 
> 
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-- 

Tim Wescott
www.wescottdesign.com
Control & Communications systems, circuit & software design.
Phone: 503.631.7815
Cell:  503.349.8432


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Scilab control after an impossible calculation

2016-10-06 Thread Samuel Gougeon

Le 06/10/2016 12:31, paul.carr...@free.fr a écrit :

thanks for the advice

well I tried but it does not work as expected ; errcatch seems to be 
obsolete so I'm testing it with execstr: the warning is not displayed 
... why 

Try / catch / end was very buggy in Scilab 5.
Scilab 6 efficiently fixes all (or at least most of) reported 
errors-handling errors. It is now reliable.

It is one of the great reliefs provided by Scilab 6.

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Scilab control after an impossible calculation

2016-10-06 Thread paul . carrico
thanks everybody for the supports 


Paul 

- Mail original -

De: "Mike Page" <mike.page...@googlemail.com> 
À: "Users mailing list for Scilab" <users@lists.scilab.org> 
Envoyé: Jeudi 6 Octobre 2016 12:34:59 
Objet: Re: [Scilab-users] Scilab control after an impossible calculation 







Hi Paul, 

Would Scilab's try-catch block do what you want? For example: 

for i=1:10; 
try; 
disp(1/(i-5)); 
catch; 
disp("err"); 
end; 
end 

won't crash when it gets to the divide by zero. 

This is the more structured way, but you can use execstr with errcatch to do 
the same thing. 

HTH 
Mike. 




On 6 October 2016 at 09:51, < paul.carr...@free.fr > wrote: 





Hi All 

I’m using Scilab as the interface between my optimizer and my finite element 
solver(s) and sometimes Scilab stops because of unexpected and impossible 
calculus (1/x with x = 0 as an example ); obviously Scilab stops (and so the 
optimization). 

I’m wondering if it’s possible: 
- To ask back Scilab a message such as “hey I crashed because you’re a fool and 
you’ve not anticipated an impossible calculation !!!” 
- To get back Scilab control in order to avoid optimization process crash ? 
I’ve been thinking in affecting a cost function value at %inf for example (not 
elegant I recognize) 

I don’t know if I’m understandable enough … 

Paul 
___ 
users mailing list 
users@lists.scilab.org 
http://lists.scilab.org/mailman/listinfo/users 





___ 
users mailing list 
users@lists.scilab.org 
http://lists.scilab.org/mailman/listinfo/users 

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Scilab control after an impossible calculation

2016-10-06 Thread Serge Steer
If you use optim you can  set the ind retured arg to -1 in the cost 
function to say that the function cannot be evaluated at this point.


Serge

Le 06/10/2016 à 10:51, paul.carr...@free.fr a écrit :


Hi All

I’m using Scilab as the interface between my optimizer and my finite 
element solver(s) and sometimes Scilab stops because of unexpected and 
impossible calculus (1/x with x = 0 as an example ); obviously Scilab 
stops (and so the optimization).


I’m wondering if it’s possible:

-To ask back Scilab a message such as “hey I crashed because you’re a 
fool and you’ve not anticipated an impossible calculation !!!”


-To get back Scilab control in order to avoid optimization process 
crash ? I’ve been thinking in affecting a cost function value at %inf 
for example (not elegant I recognize)


I don’t know if I’m understandable enough …

Paul



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Scilab control after an impossible calculation

2016-10-06 Thread Mike Page
Hi Paul,

Would Scilab's try-catch block do what you want?  For example:

for i=1:10;
   try;
  disp(1/(i-5));
   catch;
  disp("err");
   end;
end

won't crash when it gets to the divide by zero.

This is the more structured way, but you can use execstr with errcatch to
do the same thing.

HTH
Mike.


On 6 October 2016 at 09:51,  wrote:

> Hi All
>
>
>
> I’m using Scilab as the interface between my optimizer and my finite
> element solver(s) and sometimes Scilab stops because of unexpected and
> impossible calculus (1/x with x = 0 as an example ); obviously Scilab stops
> (and so the optimization).
>
>
>
> I’m wondering if it’s possible:
>
> -  To ask back Scilab a message such as “hey I crashed because
> you’re a fool and you’ve not anticipated an impossible calculation !!!”
>
> -  To get back Scilab control in order to avoid optimization
> process crash ? I’ve been thinking in affecting a cost function value at
> %inf for example (not elegant I recognize)
>
>
>
> I don’t know if I’m understandable enough …
>
>
>
> Paul
>
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
>
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Scilab control after an impossible calculation

2016-10-06 Thread paul . carrico

thanks for the advice 

well I tried but it does not work as expected ; errcatch seems to be obsolete 
so I'm testing it with execstr: the warning is not displayed ... why  


### 

mode(0) 


try 
x = 0; 
y = (1/x) 


if execstr(('y','errcatch') <> 0) then 
printf("you''re a fool\n"); 
else 
printf("Everything is going well\n"); 
end 
errclear; 
end 
- Mail original -

De: "Jens Simon Strom" <j.s.st...@hslmg.de> 
À: "Users mailing list for Scilab" <users@lists.scilab.org> 
Envoyé: Jeudi 6 Octobre 2016 11:48:50 
Objet: Re: [Scilab-users] Scilab control after an impossible calculation 

Try errcatch (). 

 

Am 06.10.2016 10:51, schrieb paul.carr...@free.fr : 




Hi All 

I’m using Scilab as the interface between my optimizer and my finite element 
solver(s) and sometimes Scilab stops because of unexpected and impossible 
calculus (1/x with x = 0 as an example ); obviously Scilab stops (and so the 
optimization). 

I’m wondering if it’s possible: 
- To ask back Scilab a message such as “hey I crashed because you’re a fool and 
you’ve not anticipated an impossible calculation !!!” 
- To get back Scilab control in order to avoid optimization process crash ? 
I’ve been thinking in affecting a cost function value at %inf for example (not 
elegant I recognize) 

I don’t know if I’m understandable enough … 

Paul 

___
users mailing list users@lists.scilab.org 
http://lists.scilab.org/mailman/listinfo/users 



___ 
users mailing list 
users@lists.scilab.org 
http://lists.scilab.org/mailman/listinfo/users 

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Scilab control after an impossible calculation

2016-10-06 Thread Jens Simon Strom

Try   errcatch().


Am 06.10.2016 10:51, schrieb paul.carr...@free.fr:


Hi All

I'm using Scilab as the interface between my optimizer and my finite 
element solver(s) and sometimes Scilab stops because of unexpected and 
impossible calculus (1/x with x = 0 as an example ); obviously Scilab 
stops (and so the optimization).


I'm wondering if it's possible:

-To ask back Scilab a message such as "hey I crashed because you're a 
fool and you've not anticipated an impossible calculation !!!"


-To get back Scilab control in order to avoid optimization process 
crash ? I've been thinking in affecting a cost function value at %inf 
for example (not elegant I recognize)


I don't know if I'm understandable enough ...

Paul



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] Scilab control after an impossible calculation

2016-10-06 Thread paul . carrico

Hi All 

I’m using Scilab as the interface between my optimizer and my finite element 
solver(s) and sometimes Scilab stops because of unexpected and impossible 
calculus (1/x with x = 0 as an example ); obviously Scilab stops (and so the 
optimization). 

I’m wondering if it’s possible: 
- To ask back Scilab a message such as “hey I crashed because you’re a fool and 
you’ve not anticipated an impossible calculation !!!” 
- To get back Scilab control in order to avoid optimization process crash ? 
I’ve been thinking in affecting a cost function value at %inf for example (not 
elegant I recognize) 

I don’t know if I’m understandable enough … 

Paul___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users