ibex-team / ibex-lib

IBEX is a C++ library for constraint processing over real numbers.
http://ibex-team.github.io/ibex-lib/
GNU Lesser General Public License v3.0
67 stars 51 forks source link

Clarification regarding contractor bitsets #509

Closed eparrott closed 3 years ago

eparrott commented 3 years ago

Hello,

I was just wondering if it was possible to get some additional clarification (beyond what's already contained in the documentation) on how exactly passing bitsets to contractors for a system is supposed to work. I have a minibex system to which I need to pass a fair number of parameters as variables, however I only want to contract a small subset of these and treat the others essentially as constants (I can't just define them as constants, however, as I need to be able to modify their values from outside the system). It seems like making the distinction of which parameters to contract should be easily doable with the bitset feature, but I'm struggling to figure out how to implement it using the generic contractors. Any guidance would be greatly appreciated!

gchabert commented 3 years ago

My advice is to use mutable constants. It's unfortunately not documented yet, but this is what best fits your problem. Just add a star below the constant declaration in the Minibex file, e.g.,

constants 
 * x = 1;   // ---> mutable constant
   y = 2;   //        regular constant

The constant is then accessible in c++ and can be dynamically changed, see the System::constant(char*) function. But be aware that a mutable constant also hinders the simplification process (so to be used with parsimony). Hope it will solve your problem.

eparrott commented 3 years ago

Thanks Gilles!

That actually sounds like exactly what I'm looking for! I appreciate your help!

Cheers,

Ted

Edward Parrott - BSE.ME, MSc.ME PhD Candidate - Advanced Controls University of New Brunswick 506-878-3859

-------- Original message -------- From: Gilles Chabert @.> Date: 2021-05-10 5:59 p.m. (GMT-04:00) To: ibex-team/ibex-lib @.> Cc: Edward Barrington Parrott @.>, Author @.> Subject: Re: [ibex-team/ibex-lib] Clarification regarding contractor bitsets (#509)

✉External message: Use caution.

My advice is to use mutable constants. It's unfortunately not documented yet, but this is what best fits your problem. Just add a star below the constant declaration in the Minibex file, e.g.,

constants

The constant is then accessible in c++ and can be dynamically changed, see the System::constant(char*) function. But be aware that a mutable constant also hinders the simplification process (so to be used with parsimony). Hope it will solve your problem.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ibex-team/ibex-lib/issues/509#issuecomment-837332604, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMERNWVRECHRM2MPAYSHEDDTNBCLVANCNFSM44EY3X6Q.

gchabert commented 3 years ago

You're welcome. Do you allow me to add your name in the guest book ?

eparrott commented 3 years ago

Gilles,

Sure! Go right ahead.

Ted

Edward Parrott - BSE.ME, MSc.ME PhD Candidate - Advanced Controls University of New Brunswick 506-878-3859

-------- Original message -------- From: Gilles Chabert @.> Date: 2021-05-10 6:13 p.m. (GMT-04:00) To: ibex-team/ibex-lib @.> Cc: Edward Barrington Parrott @.>, Author @.> Subject: Re: [ibex-team/ibex-lib] Clarification regarding contractor bitsets (#509)

✉External message: Use caution.

You're welcome. Do you allow me to add your name in the guest bookhttp://www.ibex-lib.org/guestbook ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ibex-team/ibex-lib/issues/509#issuecomment-837352073, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMERNWQSA6MTI4KAXHBRJQTTNBEAZANCNFSM44EY3X6Q.