16 using System.Collections.
Generic;
22 public partial class Solver {
28 for (
int i = 0; i < count; ++i) {
29 array[i] =
MakeVar(lb, ub, integer,
"");
40 for (
int i = 0; i < count; ++i) {
41 array[i] =
MakeVar(lb, ub, integer, var_name + i);
52 for (
int i = 0; i < rows; ++i) {
53 for (
int j = 0; j < cols; ++j) {
54 matrix[i,j] =
MakeVar(lb, ub, integer,
"");
67 for (
int i = 0; i < rows; ++i) {
68 for (
int j = 0; j < cols; ++j) {
69 string var_name = name +
"[" + i +
", " + j +
"]";
70 matrix[i,j] =
MakeVar(lb, ub, integer, var_name);
92 for (
int i = 0; i < rows; ++i) {
93 for (
int j = 0; j < cols; ++j) {
106 for (
int i = 0; i < rows; ++i) {
107 for (
int j = 0; j < cols; ++j) {
108 string var_name = name +
"[" + i +
", " + j +
"]";
131 for (
int i = 0; i < rows; ++i) {
132 for (
int j = 0; j < cols; ++j) {
145 for (
int i = 0; i < rows; ++i) {
146 for (
int j = 0; j < cols; ++j) {
147 string var_name = name +
"[" + i +
", " + j +
"]";
164 for (
int i = 0; i < rows; ++i) {
165 for (
int j = 0; j < cols; ++j) {
174 for (
int i = 0; i < rows; ++i) {
175 for (
int j = 0; j < cols; ++j) {
176 string var_name = name +
"[" + i +
", " + j +
"]";
184 System.Reflection.FieldInfo fieldInfo =
185 typeof(
Solver).GetField(solverType);
186 if (fieldInfo !=
null) {
187 return (
int)fieldInfo.GetValue(
null);
189 throw new System.ApplicationException(
"Solver not supported");
196 if (Enum.TryParse(type,
true, out solver_type)) {
197 return new Solver(name, solver_type);
204 return constraint.
Extract(
this);
211 Dictionary<Variable, double> coefficients =
212 new Dictionary<Variable, double>();
213 double constant = expr.
Visit(coefficients);
214 foreach (KeyValuePair<Variable, double> pair
in coefficients)
225 Dictionary<Variable, double> coefficients =
226 new Dictionary<Variable, double>();
227 double constant = expr.
Visit(coefficients);
228 foreach (KeyValuePair<Variable, double> pair
in coefficients)