Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

How to remove unneeded constraints

  • To: mathgroup at smc.vnet.net
  • Subject: [mg87904] How to remove unneeded constraints
  • From: Kristian Schmidt <kristian at kreutz.us>
  • Date: Sat, 19 Apr 2008 23:50:19 -0400 (EDT)

Hello

The problem I am working on is a pretty large problem, which I am solving by dividing it into a lot of subproblems.

As such, I have a large list of constraints that apply to the entire problem, but are not relevant for each individual subproblem.

This becomes a problem when I use Refine, as it takes a very long time when you have a lot of conditions, even though the conditions don't pertain to the problem. Example:
In[25]:= Table[Timing@Refine[p>q,Map[Subscript[x,#]>0&,Range[i]]],{i,1000,5000,1000}]
Out[25]= {{0.547,p>q},{1.797,p>q},{3.875,p>q},{8.594,p>q},{10.468,p>q}}

And it only gets worse.

However, for each individual call to Refine I make, I only need a small subset of the total constraints.

So what I want to do is something like this:
expr = some expression of n different variables;
cond = DeleteCases[totalConstraints, all cases which do not contain a variable from expr];
result = Refine[expr,cond];

I have no idea how to construct a pattern powerful enough to do what is required for the DeleteCases call, though.

All of the variables are of the form Subscript[s,_,_,_] or Subscript[b,_,_] and the conditions can also contain expressions of several variables.

I'd be most grateful for any help. Thank you.


  • Prev by Date: Re: Possible bug in WAV export
  • Next by Date: Re: Mathematica syntax
  • Previous by thread: Re: Print[Plot] vs Print[text,Plot]?
  • Next by thread: Re: How to remove unneeded constraints