FindInstance
- To: mathgroup at smc.vnet.net
- Subject: [mg63802] FindInstance
- From: "Bas Straatman" <g15bs at morgan.ucs.mun.ca>
- Date: Sat, 14 Jan 2006 02:33:33 -0500 (EST)
- Organization: Memorial University of Newfoundland
- Sender: owner-wri-mathgroup at wolfram.com
Hello, I am using FindInstance Mathematica 5.2 to find a feasable point of a set of (in)equalities (see below if you are wondering about the origine). Timing[FindInstance[Join[{p[1]==1},Map[#==0&,{{-1,o[1],0,-1}, {0,-1,o[2],-1}, {o[3],0,-1,-1}, {-1,0,0,o[4]}}.Table[p[i], {i,4}]], Map[#>0&,Join[Table[x[i], {i,4}],Table[o[i], {i,4}], Table[p[i], {i,4}]]], Map[#>=0&,Join[Table[x[i], {i,4}].{{-1,o[1],0,-1}, {0,-1,o[2],-1}, {o[3],0,-1,-1}, {-1,0,0,o[4]}}]]], Join[Table[p[i], {i,4}],Table[o[i], {i,4}],Table[x[i], {i,4}]]]] {0.094 Second, {{p[1] -> 1, p[2] -> 23112/581, p[3] -> 325376/581, p[4] -> 2308/581, o[1] -> 1/8, o[2] -> 5/64, o[3] -> 564, o[4] -> 581/2308, x[1] -> 1, x[2] -> 1/8, x[3] -> 5/512, x[4] -> 577/128} Then I change the set of constraints: x[i]'s greater or equal to 0 instead of x[i]'s strictly greater than 0. By including the boundary the space thus becomes larger and the solution above is still feasable. Nevertheless I dont' get an answer. As can be seen below, 30 seconds is not enough, longer doesn't help, it just eats memory. TimeConstrained[FindInstance[Join[{p[1]==1},Map[#==0&,{{-1,o[1],0,-1}, {0,-1,o[2],-1}, {o[3],0,-1,-1}, {-1,0,0,o[4]}}.Table[p[i], {i,4}]], Map[#>0&,Join[Table[o[i], {i,4}],Table[p[i], {i,4}]]], Map[#>=0&,Join[Table[x[i], {i,4}],Table[x[i], {i,4}].{{-1,o[1],0,-1}, {0,-1,o[2],-1}, {o[3],0,-1,-1}, {-1,0,0,o[4]}}]]], Join[Table[p[i], {i,4}],Table[o[i], {i,4}],Table[x[i], {i,4}]]], 30] $Aborted Does anybody know why this is? What are the conditions of the algorithm used within FindInstance? Thanks very much for any help. Bas Straatman If you are wondering here is some background information to the problem: I am studying small artificial economies in which production skills are given by (output - input) vectors. For example, 4 products {a,b,c,d} and a set of 4 skills are given by {{-1, o[1], 0, -1}, {0, -1, o[2], -1}, {o[3], 0, -1, -1}, {-1, 0, 0, o[4]}} where the o[i] are the (positive) output quantities. Now let {x[1], x[2], x[3], x[4]} be the activity in the economy over a certain period, x[1] times skill 1, ... x[4] times skill 4. This results in the following product requirements and output. {x[1], x[2], x[3], x[4]} . {{-1, o[1], 0, -1}, {0, -1, o[2], -1}, {o[3], 0, -1, -1}, {-1, 0, 0, o[4]}} = {-x[1] + o[3] x[3] - x[4], o[1] x[1] - x[2], o[2] x[2] - x[3], -x[1] - x[2] - x[3] + o[4] x[4]} I want a combination of activities that results in a positive production thus, Map[# >= 0 &, Table[x[i], {i, 4}], Table[x[i], {i, 4}].{{-1, o[1], 0, -1}, {0, -1, o[2], -1}, {o[3], 0, -1, -1}, {-1, 0, 0, o[4]}}] = {-x[1] + o[3] x[3] - x[4] >= 0, o[1] x[1] - x[2] >= 0, o[2] x[2] - x[3] >= 0, -x[1] - x[2] - x[3] + o[4] x[4] >= 0} In addition to this, I would like to have a price for each or the products, p[1], p[2], p[3] and p[4] such that for each of the skills price of the input equals the price of the output. Thus Map[# == 0 &, {{-1, o[1], 0, -1}, {0, -1, o[2], -1}, {o[3], 0, -1, -1}, {-1, 0, 0, o[4]}}.Table[p[i], {i, 4}]] = {-p[1] + o[1] p[2] - p[4] == 0, -p[2] + o[2] p[3] - p[4] == 0, o[3] p[1] - p[3] - p[4] == 0, -p[1] + o[4] p[4] == 0} What I am looking for is a set of output positive values o[i] and a set of positive prices p[i] and a set of positive activities x[i] that suffice the above constraints: price of the input equals price of the output and production output minus production input is greater or equal to zero for each of the products.