need explanation on how an equation is being converted to cvxopt logic in solver.lq












3












$begingroup$


This is the equation that is given in the example:



The equation



and the code to replicate it in python is



>>> from cvxopt import matrix, solvers
>>> A = matrix([ [-1.0, -1.0, 0.0, 1.0], [1.0, -1.0, -1.0, -2.0] ])
>>> b = matrix([ 1.0, -2.0, 0.0, 4.0 ])
>>> c = matrix([ 2.0, 1.0 ])
>>> sol=solvers.lp(c,A,b)


Can anyone please explain how are the the data given to variables a, b, c?










share|improve this question











$endgroup$




bumped to the homepage by Community 17 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • $begingroup$
    they are objects which have been created inside matrix function.
    $endgroup$
    – Vaalizaadeh
    Jan 30 '18 at 9:57
















3












$begingroup$


This is the equation that is given in the example:



The equation



and the code to replicate it in python is



>>> from cvxopt import matrix, solvers
>>> A = matrix([ [-1.0, -1.0, 0.0, 1.0], [1.0, -1.0, -1.0, -2.0] ])
>>> b = matrix([ 1.0, -2.0, 0.0, 4.0 ])
>>> c = matrix([ 2.0, 1.0 ])
>>> sol=solvers.lp(c,A,b)


Can anyone please explain how are the the data given to variables a, b, c?










share|improve this question











$endgroup$




bumped to the homepage by Community 17 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • $begingroup$
    they are objects which have been created inside matrix function.
    $endgroup$
    – Vaalizaadeh
    Jan 30 '18 at 9:57














3












3








3





$begingroup$


This is the equation that is given in the example:



The equation



and the code to replicate it in python is



>>> from cvxopt import matrix, solvers
>>> A = matrix([ [-1.0, -1.0, 0.0, 1.0], [1.0, -1.0, -1.0, -2.0] ])
>>> b = matrix([ 1.0, -2.0, 0.0, 4.0 ])
>>> c = matrix([ 2.0, 1.0 ])
>>> sol=solvers.lp(c,A,b)


Can anyone please explain how are the the data given to variables a, b, c?










share|improve this question











$endgroup$




This is the equation that is given in the example:



The equation



and the code to replicate it in python is



>>> from cvxopt import matrix, solvers
>>> A = matrix([ [-1.0, -1.0, 0.0, 1.0], [1.0, -1.0, -1.0, -2.0] ])
>>> b = matrix([ 1.0, -2.0, 0.0, 4.0 ])
>>> c = matrix([ 2.0, 1.0 ])
>>> sol=solvers.lp(c,A,b)


Can anyone please explain how are the the data given to variables a, b, c?







python convergence






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 30 '18 at 13:52









Stephen Rauch

1,53551330




1,53551330










asked Jan 30 '18 at 9:53









Sourav RoySourav Roy

161




161





bumped to the homepage by Community 17 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 17 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • $begingroup$
    they are objects which have been created inside matrix function.
    $endgroup$
    – Vaalizaadeh
    Jan 30 '18 at 9:57


















  • $begingroup$
    they are objects which have been created inside matrix function.
    $endgroup$
    – Vaalizaadeh
    Jan 30 '18 at 9:57
















$begingroup$
they are objects which have been created inside matrix function.
$endgroup$
– Vaalizaadeh
Jan 30 '18 at 9:57




$begingroup$
they are objects which have been created inside matrix function.
$endgroup$
– Vaalizaadeh
Jan 30 '18 at 9:57










1 Answer
1






active

oldest

votes


















0












$begingroup$

Welcome to the site!



As Media has mentioned values of A,b,c are passed through those matrices.
To understand it better I'm naming the constraints from top to bottom i.e., 1st constraint as constraints-1,......constraint-4.



Firstly, lets talk about matrix b which consists of all the values on the right hand side of the constraints i.e., 1,2,0,4. He converted all the constraints to $⩽$ by multiplying with -1 on both sides. So he multiplied with -1 for constraints-2 and 3.



Now the constraints-2 has changed from $x_1 + x_2 ⩾ 2$ to $-x_1 - x_2 ⩽ -2$



Values of Matrix b would be 1,-2,0(-0),4



Now lets go through the constraints i.e.,




  1. $-x_1 + x_2 ⩽ 1 $ for the coefficient of $x_1,x_2$ are -1 and 1. The values of Matrix A row 1 values are -1,1

  2. Similarly for row 2 to row 4 as you have 4 contraints.


Finally our objective function coefficients, are the values of c i.e., 2 and 1.



Do let me know if you have any more doubts.






share|improve this answer









$endgroup$













  • $begingroup$
    If you need some additional information let me know, or else can you help to accept the answer. Thanks in advance
    $endgroup$
    – Toros91
    May 15 '18 at 8:10












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "557"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f27232%2fneed-explanation-on-how-an-equation-is-being-converted-to-cvxopt-logic-in-solver%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0












$begingroup$

Welcome to the site!



As Media has mentioned values of A,b,c are passed through those matrices.
To understand it better I'm naming the constraints from top to bottom i.e., 1st constraint as constraints-1,......constraint-4.



Firstly, lets talk about matrix b which consists of all the values on the right hand side of the constraints i.e., 1,2,0,4. He converted all the constraints to $⩽$ by multiplying with -1 on both sides. So he multiplied with -1 for constraints-2 and 3.



Now the constraints-2 has changed from $x_1 + x_2 ⩾ 2$ to $-x_1 - x_2 ⩽ -2$



Values of Matrix b would be 1,-2,0(-0),4



Now lets go through the constraints i.e.,




  1. $-x_1 + x_2 ⩽ 1 $ for the coefficient of $x_1,x_2$ are -1 and 1. The values of Matrix A row 1 values are -1,1

  2. Similarly for row 2 to row 4 as you have 4 contraints.


Finally our objective function coefficients, are the values of c i.e., 2 and 1.



Do let me know if you have any more doubts.






share|improve this answer









$endgroup$













  • $begingroup$
    If you need some additional information let me know, or else can you help to accept the answer. Thanks in advance
    $endgroup$
    – Toros91
    May 15 '18 at 8:10
















0












$begingroup$

Welcome to the site!



As Media has mentioned values of A,b,c are passed through those matrices.
To understand it better I'm naming the constraints from top to bottom i.e., 1st constraint as constraints-1,......constraint-4.



Firstly, lets talk about matrix b which consists of all the values on the right hand side of the constraints i.e., 1,2,0,4. He converted all the constraints to $⩽$ by multiplying with -1 on both sides. So he multiplied with -1 for constraints-2 and 3.



Now the constraints-2 has changed from $x_1 + x_2 ⩾ 2$ to $-x_1 - x_2 ⩽ -2$



Values of Matrix b would be 1,-2,0(-0),4



Now lets go through the constraints i.e.,




  1. $-x_1 + x_2 ⩽ 1 $ for the coefficient of $x_1,x_2$ are -1 and 1. The values of Matrix A row 1 values are -1,1

  2. Similarly for row 2 to row 4 as you have 4 contraints.


Finally our objective function coefficients, are the values of c i.e., 2 and 1.



Do let me know if you have any more doubts.






share|improve this answer









$endgroup$













  • $begingroup$
    If you need some additional information let me know, or else can you help to accept the answer. Thanks in advance
    $endgroup$
    – Toros91
    May 15 '18 at 8:10














0












0








0





$begingroup$

Welcome to the site!



As Media has mentioned values of A,b,c are passed through those matrices.
To understand it better I'm naming the constraints from top to bottom i.e., 1st constraint as constraints-1,......constraint-4.



Firstly, lets talk about matrix b which consists of all the values on the right hand side of the constraints i.e., 1,2,0,4. He converted all the constraints to $⩽$ by multiplying with -1 on both sides. So he multiplied with -1 for constraints-2 and 3.



Now the constraints-2 has changed from $x_1 + x_2 ⩾ 2$ to $-x_1 - x_2 ⩽ -2$



Values of Matrix b would be 1,-2,0(-0),4



Now lets go through the constraints i.e.,




  1. $-x_1 + x_2 ⩽ 1 $ for the coefficient of $x_1,x_2$ are -1 and 1. The values of Matrix A row 1 values are -1,1

  2. Similarly for row 2 to row 4 as you have 4 contraints.


Finally our objective function coefficients, are the values of c i.e., 2 and 1.



Do let me know if you have any more doubts.






share|improve this answer









$endgroup$



Welcome to the site!



As Media has mentioned values of A,b,c are passed through those matrices.
To understand it better I'm naming the constraints from top to bottom i.e., 1st constraint as constraints-1,......constraint-4.



Firstly, lets talk about matrix b which consists of all the values on the right hand side of the constraints i.e., 1,2,0,4. He converted all the constraints to $⩽$ by multiplying with -1 on both sides. So he multiplied with -1 for constraints-2 and 3.



Now the constraints-2 has changed from $x_1 + x_2 ⩾ 2$ to $-x_1 - x_2 ⩽ -2$



Values of Matrix b would be 1,-2,0(-0),4



Now lets go through the constraints i.e.,




  1. $-x_1 + x_2 ⩽ 1 $ for the coefficient of $x_1,x_2$ are -1 and 1. The values of Matrix A row 1 values are -1,1

  2. Similarly for row 2 to row 4 as you have 4 contraints.


Finally our objective function coefficients, are the values of c i.e., 2 and 1.



Do let me know if you have any more doubts.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 30 '18 at 10:14









Toros91Toros91

2,0142829




2,0142829












  • $begingroup$
    If you need some additional information let me know, or else can you help to accept the answer. Thanks in advance
    $endgroup$
    – Toros91
    May 15 '18 at 8:10


















  • $begingroup$
    If you need some additional information let me know, or else can you help to accept the answer. Thanks in advance
    $endgroup$
    – Toros91
    May 15 '18 at 8:10
















$begingroup$
If you need some additional information let me know, or else can you help to accept the answer. Thanks in advance
$endgroup$
– Toros91
May 15 '18 at 8:10




$begingroup$
If you need some additional information let me know, or else can you help to accept the answer. Thanks in advance
$endgroup$
– Toros91
May 15 '18 at 8:10


















draft saved

draft discarded




















































Thanks for contributing an answer to Data Science Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f27232%2fneed-explanation-on-how-an-equation-is-being-converted-to-cvxopt-logic-in-solver%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Ponta tanko

Tantalo (mitologio)

Erzsébet Schaár