Linear Programming - deriving the Dual of the Primal [closed] - linear-programming

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 3 years ago.
Improve this question
I've the following linear programming problem:
This is the LP representation of the uncapacitated facility location problem.
This is the dual representation of this problem:
My question is how to derive the dual representation from the primal in this problem.
I tried to follow the step by step tutorial by S´ebastien Lahaie found here
but it won't work because of the summation in the constraint equations.
I'm looking for a pure mechanical way (with no intuition) to do that.

The step by step tutorial actually works quite fine. It looks like I've lost a sign somewhere, but the fourth step will produce:
Where did I get it? I just multiplied the constraint by and added it to the objective clause for every j, then I did the same with the other constraint.
Now I just group the terms by the primal variables. What I get is basically:
note that I use i implicitly for the set F and j for the set D. And sorry for the bad formatting.

Related

Solving system of equation modulo 2 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I make a program in C++, that factorizes natural numbers. The only problem is to create a function that does the following:
input: it receives a matrix vector< vector< int> > M.
output: it gives a vector v so that a result of multiplying v and M is a vector that all its coordinates are equal to 0.
Everything must be modulo 2, so coefficients of M and v consists only 0s and 1s
Schould I use a Gauss elimination method? If so, how do this? The problem that implementations I saw on the net don't use vectors and the vectors are necessary in my main program
I would be grateful if someone helped me.
Regards
This is an interesting problem. The steps to be taken can be found in this exercise. link.
The tricky part is to understand that there are always only a finite number of solutions, i.e, only the trivial solution exists or non-trivial solutions exist.
Once you finish the row reduction steps and if non-trivial solutions exist, there is always going to be at least one independent variable (it can take any value 0/1) and the rest of the variables depend on the independent variables.

Fortran solving for unknown upper bound of the integral [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I am trying to implement an algorithm in Fortran that involves solving for the boundary limit of the integral.
For example, I want to find a given the following integral: integral_(0-t) exp(t) dt = 1/2. which fortran should solve for t.
how would one go about solving this in Fortran? Thanks for your suggestions.
Your specific example can be easily solved exactly using logarithms, but I take it that you meant that simply as an illustrative example. If f(t) is your integrand and k is the target value then you are trying to find a root of the function
g(t) = integral_0^t f(u)du - k
You could try Newton's method to find that root. Newton's method requires that you can evaluate g(t) -- which you can by any numerical integration method, and also that you can evaluate its derivative g'(t) -- but this is even easier since by the Fundamental Theorem of Calculus, g'(t) = f(t) (assuming f is continuous).
Newton's method doesn't always converge and it tends to do better if the seed value is close to the root. You could try a preliminary bisection approach which gets you tolerably close to the root followed by Newton's method to refine it.

Gaussian Elimination of a Singular Matrix [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
So i've been struggling to find code which can solve a set of simultaneous equations and also handle possibilities of Infinite Solutions, i.e. a singular Matrix. From all the sample code Gaussian Elimination in C that i've encountered the problem arises when dividing by zero in one of the steps for row reduction. Surely there must be some numerical ways to counter this problem.
Gaussian elimination[1] does not work on singular matrices. As you noticed numerically this usually leads to devision by zero or some other problem. If you suspect that a the matrix you want to diagonalize might be singular (or numerically close to singular) you should check out Singular Value Decomposition (SVD) which either provides you with the inverse matrix or something close. A nice resource is Numerical Recipes[1] or GSL[2] if you want to look into the how and why.
[1] http://www.haoli.org/nr/bookcpdf.html (Chap. 2.1)
[2] http://www.gnu.org/software/gsl/

Obtaining an algorithm [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Let's say I have a variable a and b. Now I want to find a value for c such that the fraction a / c is a positive integer, and where c is as close to b as possible.
For example: a = 100 and b = 30.
In this case I want c to be 25; because a / c is an integer, and c is as close as b for which this holds.
Any ideas how I can program a function in C++ which does exactly this?
Find the factors of a. (search web for methods)
Scan resulting list for minimum difference vs b.
Is this a homework assignment? Either way, think about how you would solve this problem without writing any code. A good algorithm comes from a good design. Break the problem down into pieces and walk through some more examples. For example, how would you solve the problem of determining whether the division results in an integer value? Hint: There is a different operator you could use as opposed to division to achieve this easily. Now, how would you solve the problem of determining what number to start at for c in the algorithm? Do not write any code until you have the pseudocode figured out.

Weka analysis and predictions [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
i am doing this project that has several inputs and several outputs at the same time.
is there a way to do a prediction for more than 1 class at the same time in Weka?
any help is highly appreciated
thank you
Morning,
Weka only supports single class attributes. However, untested, I think you may be able to work around this. Try the following, I'm interested as to what kind of accuracy you get.
eg data.
BloodIron real
BloodSuger real
BloodColor real
Diabetes bool class
Lifespan real class
Using the data above, train to solve only the 'Diabetes' class. Once you have the variables enter them into your dataset and use them to solve your second 'LifeSpan' class attribute.
To increase accuracy solve the class variable with the highest entropy first.