MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: is there a better way to do constraint logic programming in Mathematica?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80923] Re: is there a better way to do constraint logic programming in Mathematica?
  • From: "sdw" <warwick at jps.net>
  • Date: Wed, 5 Sep 2007 03:02:18 -0400 (EDT)
  • References: <fbj2lj$ngh$1@smc.vnet.net>

don't see how this one guarantees values are all distinct

"Dana DeLouis" <dana.del at gmail.com> wrote in message 
news:fbj2lj$ngh$1 at smc.vnet.net...
> Just another idea:
>
> v=Array[x,5];
>
> equ={
> Tr[v]==22,
> Less@@v,
> First[v]>=1,
> Last[v]<=10
> };
>
> v/.FindInstance[equ,v,Integers,100];
>
> (* or *)
>
> v/. ToRules /@ List @@ Reduce[equ,v,Integers];
>
> -- 
> HTH   :>)
> Dana DeLouis
> 6.0, but 5.2 Help files & 4.0 Book
>
>
> "sdw" <warwick at jps.net> wrote in message
> news:fbar15$qft$1 at smc.twtelecom.net...
>>
>> simplified constraint programming example in Mathematica:
>>
>> find a set of numbers that add to a particular value - numbers cannot be
>> the same
>>
>> note  huge timing problem as we go up in variables
>>
>> Above 5, it hung...
>
> <snip>
>
> 




  • Prev by Date: Re: What is $MaxNumber on a 64 bit Computer?
  • Next by Date: Re: Unevaluated hypergeometric functions
  • Previous by thread: Re: is there a better way to do constraint logic programming in Mathematica?
  • Next by thread: Re: is there a better way to do constraint logic programming in Mathematica?