You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+101
Original file line number
Diff line number
Diff line change
@@ -12,3 +12,104 @@ from analyzer import tech_support
12
12
# Analyze the problem.
13
13
tech_support(problem)
14
14
```
15
+
16
+
17
+
# Visual:
18
+
The Purpose of our project is to visualize the Problem expressions which can be found in CVXPY library. <br />
19
+
During the development process, we have created four different functions that allow to visualize the Problem expressions in a more accessible and clear way for library users. <br />
20
+
As you can see in the file: ``examples.py`` <br />
21
+
You can see several examples of how to run expressions using the different functions we created.
22
+
23
+
## v.draw_graph(xmin, xmax):
24
+
A function that graphically displays all the solutions of a specific expression where the variable is represented as X and the equation as Y.
25
+
If a function is called without any arguments, the default value will be xmin=-10 xmax=10.
26
+
27
+
Here you can see the results:
28
+
As you can see for the phrase: `Minimize(-1 * (y2) ** 2 + 2 * y2)` <br />
29
+
with the constraints `[y2 >= 1]` <br />
30
+
31
+
```
32
+
33
+
y2 = Variable()
34
+
35
+
objective = Minimize(-1 * (y2) ** 2 + 2 * y2)
36
+
constraints = [y2 >= 1]
37
+
v = Visual(objective)
38
+
print(v.expr)
39
+
v.draw_graph()
40
+
```
41
+
by running `v.draw_graph()` you will get the following graph:<br />
It displays all the solutions of the equation that we want to see when substituting variable values between -10 to 10.
45
+
46
+
## v.show_and_save(file_name):
47
+
We created this function to enable viewing the expression in a graph format with nodes, which will allow for visual and clear representation. <br />
48
+
For each expression you choose, the function's output is a PDF file named "file_name.pdf", which is very similar to the DCP Analyzer. https://dcp.stanford.edu/analyzer <br />
49
+
50
+
Here too it was important for us to present for all: Parameters , Variables <br />
51
+
Which `Sing` is of a type of `Positive` , `Negative`, `Unknown` and Which `Curvature` is of a type of `Constant`,`Affine`,`Convex`,`Concave`,`Unknown`. <br />
52
+
53
+
In the ``example.py`` file you can run several expressions on this function.
**Please note that you can run only one example at a time and not all of them together. If you run all of them together, the output file will show only the graph of the last example that was executed** <br />
71
+
72
+
73
+
## v.print_expr():
74
+
This function prints the expression in the structure of a tree in the RUN window.
75
+
76
+
```
77
+
x2 = Variable()
78
+
y2 = Variable()
79
+
80
+
objective1 = Minimize((x2 - y2) ** 2)
81
+
82
+
# examples for print_tree:
83
+
84
+
print("---objective 1 ---")
85
+
v = Visual(objective1)
86
+
print(v.curvature_sign_list)
87
+
print("---objective 1 ---")
88
+
89
+
v.print_expr()
90
+
```
91
+
For each expression, you can run the following function,<br />
92
+
This will produce a graph that will be displayed in the runtime window.
0 commit comments