25 비공개문자열[] 마침표 =
신규문자열[]
"얀",
"2월",
"마르",
"4월",
"5월",
"준",
"7월",
"8월",
"9월",
"10월",
"11월",
"12월"};
26 비공개사전<튜플<문자열, 문자열>,
더블> landreq =
신규사전<Tuple<문자열, 문자열>,
더블>()
28{
신규튜플<문자열,문자열> (
"밀",
"얀"), 1 },
29{
신규튜플<문자열,문자열> (
"밀",
"2월"), 1 },
30{
신규튜플<문자열,문자열> (
"밀",
"마르"), 1 },
31{
신규튜플<문자열,문자열> (
"밀",
"4월"), 1 },
32{
신규튜플<문자열,문자열> (
"밀",
"5월"), 1 },
33{
신규튜플<문자열,문자열> (
"밀",
"11월"), 0.5 },
34{
신규튜플<문자열,문자열> (
"밀",
"12월"), 1 },
36{
신규튜플<문자열,문자열> (
"클로버",
"얀"), 1 },
37{
신규튜플<문자열,문자열> (
"클로버",
"2월"), 1 },
38{
신규튜플<문자열,문자열> (
"클로버",
"마르"), 0.5 },
39{
신규튜플<문자열,문자열> (
"클로버",
"11월"), 0.25 },
40{
신규튜플<문자열,문자열> (
"클로버",
"12월"), 1 },
42{
신규튜플<문자열,문자열> (
"콩",
"얀"), 1 },
43{
신규튜플<문자열,문자열> (
"콩",
"2월"), 1 },
44{
신규튜플<문자열,문자열> (
"콩",
"마르"), 1 },
45{
신규튜플<문자열,문자열> (
"콩",
"4월"), 1 },
46{
신규튜플<문자열,문자열> (
"콩",
"11월"), 0.25 },
47{
신규튜플<문자열,문자열> (
"콩",
"12월"), 1 },
49{
신규튜플<문자열,문자열> (
"양파",
"얀"), 1 },
50{
신규튜플<문자열,문자열> (
"양파",
"2월"), 1 },
51{
신규튜플<문자열,문자열> (
"양파",
"마르"), 1 },
52{
신규튜플<문자열,문자열> (
"양파",
"4월"), 1 },
53{
신규튜플<문자열,문자열> (
"양파",
"5월"), 0.25 },
54{
신규튜플<문자열,문자열> (
"양파",
"11월"), 0.5 },
55{
신규튜플<문자열,문자열> (
"양파",
"12월"), 1 },
57{
신규튜플<문자열,문자열> (
"면",
"마르"), 0.5 },
58{
신규튜플<문자열,문자열> (
"면",
"4월"), 1 },
59{
신규튜플<문자열,문자열> (
"면",
"5월"), 1 },
60{
신규튜플<문자열,문자열> (
"면",
"준"), 1 },
61{
신규튜플<문자열,문자열> (
"면",
"7월"), 1 },
62{
신규튜플<문자열,문자열> (
"면",
"8월"), 1 },
63{
신규튜플<문자열,문자열> (
"면",
"9월"), 1 },
64{
신규튜플<문자열,문자열> (
"면",
"10월"), 1 },
65{
신규튜플<문자열,문자열> (
"면",
"11월"), 0.75 },
67{
신규튜플<문자열,문자열> (
"옥수수",
"5월"), 0.25 },
68{
신규튜플<문자열,문자열> (
"옥수수",
"준"), 1 },
69{
신규튜플<문자열,문자열> (
"옥수수",
"7월"), 1 },
70{
신규튜플<문자열,문자열> (
"옥수수",
"8월"), 1 },
71{
신규튜플<문자열,문자열> (
"옥수수",
"9월"), 1 },
72{
신규튜플<문자열,문자열> (
"옥수수",
"10월"), 0.5 },
74{
신규튜플<문자열,문자열> (
"토마토",
"7월"), 0.75 },
75{
신규튜플<문자열,문자열> (
"토마토",
"8월"), 1 },
76{
신규튜플<문자열,문자열> (
"토마토",
"9월"), 1 },
77{
신규튜플<문자열,문자열> (
"토마토",
"10월"), 1 },
78{
신규튜플<문자열,문자열> (
"토마토",
"11월"), 0.75 }
81 비공개사전<Tuple<문자열, 문자열>,
더블> 노동요구 =
신규사전<Tuple<문자열, 문자열>,
더블>()
83{
신규튜플<문자열,문자열> (
"밀",
"얀"), 1.72 },
84{
신규튜플<문자열,문자열> (
"밀",
"2월"), 0.5 },
85{
신규튜플<문자열,문자열> (
"밀",
"마르"), 1 },
86{
신규튜플<문자열,문자열> (
"밀",
"4월"), 1 },
87{
신규튜플<문자열,문자열> (
"밀",
"5월"), 17.16 },
88{
신규튜플<문자열,문자열> (
"밀",
"준"), 2.34 },
89{
신규튜플<문자열,문자열> (
"밀",
"11월"), 2.43 },
90{
신규튜플<문자열,문자열> (
"밀",
"12월"), 1.35 },
92{
신규튜플<문자열,문자열> (
"클로버",
"얀"), 4.5 },
93{
신규튜플<문자열,문자열> (
"클로버",
"2월"), 1 },
94{
신규튜플<문자열,문자열> (
"클로버",
"마르"), 8 },
95{
신규튜플<문자열,문자열> (
"클로버",
"11월"), 2.5 },
96{
신규튜플<문자열,문자열> (
"클로버",
"12월"), 7.5 },
98{
신규튜플<문자열,문자열> (
"콩",
"얀"), 0.75 },
99{
신규튜플<문자열,문자열> (
"콩",
"2월"), 0.75 },
100{
신규튜플<문자열,문자열> (
"콩",
"마르"), 0.75 },
101{
신규튜플<문자열,문자열> (
"콩",
"4월"), 16 },
102{
신규튜플<문자열,문자열> (
"콩",
"11월"), 7.5 },
103{
신규튜플<문자열,문자열> (
"콩",
"12월"), 0.75 },
105{
신규튜플<문자열,문자열> (
"양파",
"얀"), 5.16 },
106{
신규튜플<문자열,문자열> (
"양파",
"2월"), 5 },
107{
신규튜플<문자열,문자열> (
"양파",
"마르"), 5 },
108{
신규튜플<문자열,문자열> (
"양파",
"4월"), 19.58 },
109{
신규튜플<문자열,문자열> (
"양파",
"5월"), 2.42 },
110{
신규튜플<문자열,문자열> (
"양파",
"11월"), 11.16 },
111{
신규튜플<문자열,문자열> (
"양파",
"12월"), 4.68 },
113{
신규튜플<문자열,문자열> (
"면",
"마르"), 5 },
114{
신규튜플<문자열,문자열> (
"면",
"4월"), 5 },
115{
신규튜플<문자열,문자열> (
"면",
"5월"), 9 },
116{
신규튜플<문자열,문자열> (
"면",
"준"), 2 },
117{
신규튜플<문자열,문자열> (
"면",
"7월"), 1.5 },
118{
신규튜플<문자열,문자열> (
"면",
"8월"), 2 },
119{
신규튜플<문자열,문자열> (
"면",
"9월"), 1 },
120{
신규튜플<문자열,문자열> (
"면",
"10월"), 26 },
121{
신규튜플<문자열,문자열> (
"면",
"11월"), 12 },
123{
신규튜플<문자열,문자열> (
"옥수수",
"5월"), 4.3 },
124{
신규튜플<문자열,문자열> (
"옥수수",
"준"), 5.04 },
125{
신규튜플<문자열,문자열> (
"옥수수",
"7월"), 7.16 },
126{
신규튜플<문자열,문자열> (
"옥수수",
"8월"), 7.97 },
127{
신규튜플<문자열,문자열> (
"옥수수",
"9월"), 4.41 },
128{
신규튜플<문자열,문자열> (
"옥수수",
"10월"), 1.12 },
130{
신규튜플<문자열,문자열> (
"토마토",
"7월"), 17 },
131{
신규튜플<문자열,문자열> (
"토마토",
"8월"), 15 },
132{
신규튜플<문자열,문자열> (
"토마토",
"9월"), 12 },
133{
신규튜플<문자열,문자열> (
"토마토",
"10월"), 7 },
134{
신규튜플<문자열,문자열> (
"토마토",
"11월"), 6 }
137 비공개사전<문자열, 이중> 수율 =
신규사전<문자열, 더블>()
148 비공개사전<문자열, 이중> 가격 =
신규사전<문자열, 더블>()
158 비공개Dictionary<String, double> miscost =
신규사전<문자열, 더블>()
174InitializeComponent();
179this.dataGridLandReq.Rows.Add();
180this.dataGridLaborReq.Rows.Add();
181this.dataGridLandReq.Rows[this.dataGridLandReq.Rows.Count - 1].HeaderCell.Value = p;
182this.dataGridLaborReq.Rows[this.dataGridLaborReq.Rows.Count - 1].HeaderCell.Value = p;
186this.dataGridYPM.Rows.Add(3);
187this.dataGridYPM.Rows[0].HeaderCell.Value =
"수익률";
188this.dataGridYPM.Rows[0].HeaderCell.ToolTipText =
"작물 수확량(ha당 톤)";
189this.dataGridYPM.Rows[1].HeaderCell.Value =
"가격";
190this.dataGridYPM.Rows[1].HeaderCell.ToolTipText =
"곡물 가격 (톤당 $)";
191this.dataGridYPM.Rows[2].HeaderCell.Value =
"잘못된 비용";
192this.dataGridYPM.Rows[2].HeaderCell.ToolTipText =
"기타 현금 비용(ha당 $)";
195 foreach(KeyValuePair<Tuple<문자열, 문자열>,
더블> kv
에landreq)
197 foreach(DataGridViewRow r
inthis.dataGridLandReq.Rows)
198 if(kv.Key.Item2.Equals(r.HeaderCell.Value))
200r.Cells[kv.Key.Item1 +
"_land"].값 = kv.값;
206 foreach(KeyValuePair<Tuple<문자열, 문자열>,
더블> kv
in노동요구)
208 foreach(DataGridViewRow r
inthis.dataGridLaborReq.Rows)
209 if(kv.Key.Item2.Equals(r.HeaderCell.Value))
211r.Cells[kv.Key.Item1 +
"_lab"].값 = kv.값;
217 foreach(DataGridViewRow r
inthis.dataGridYPM.Rows)
219 if (
"수익률".Equals(r.HeaderCell.Value))
221 foreach(KeyValuePair<String, double> kv
in수율)
222r.Cells[kv.Key +
"_ypm"].값 = kv.값;
224 그밖에 if (
"가격".Equals(r.HeaderCell.Value))
226 foreach(KeyValuePair<문자열, 더블> kv
에가격)
227r.Cells[kv.Key +
"_ypm"].값 = kv.값;
229 그밖에 if (
"잘못된 비용".Equals(r.HeaderCell.Value))
231 foreach(KeyValuePair<String, double> kv
in불가)
232r.Cells[kv.Key +
"_ypm"].값 = kv.값;
237this.textBoxLand.Text = this.land.ToString();
238this.textBoxOwage.Text = this.owage.ToString();
239this.textBoxTwage.Text = this.twage.ToString();
242this.dataGridCR.Rows.Add(3);
243this.dataGridCR.Rows[0].HeaderCell.Value =
"토지 이용";
244this.dataGridCR.Rows[1].HeaderCell.Value =
"출력";
245this.dataGridCR.Rows[2].HeaderCell.Value =
"수익";
247this.dataGridViewLRS.Rows.Add(13);
248 for (
inti = 0; i < 마침표.길이; 나++)
249this.dataGridViewLRS.Rows[i].HeaderCell.Value = 마침표[i];
250this.dataGridViewLRS.Rows[12].HeaderCell.Value =
"전체";
254 비공개 공허button1_Click_1(
객체발신자, EventArgs e)
256this.button1.Enabled =
거짓;
258this.chart1.Series.Clear();
259this.chart1.ResetAutoValues();
260this.chart1.Visible =
참;
261시리즈 s = this.chart1.Series.Add(
"토지 이용");
262s.ChartType = SeriesChartType.Pie;
264s[
"PieLabelStyle"] =
"외부";
265s.라벨 =
"#VALX (#PERCENT)";
266this.chart1.ChartAreas[0].Area3DStyle.Enable3D =
참;
267this.chart1.Legends[0].Enabled =
거짓;
269this.chart2.Series.Clear();
270this.chart2.ResetAutoValues();
271this.chart2.Visible =
참;
272this.chart2.Series.Add(
"totlanduse").ChartType = SeriesChartType.Column;
273this.chart2.ChartAreas[0].Area3DStyle.Enable3D =
참;
274this.chart2.ChartAreas[0].AxisX.Interval = 1;
275this.chart2.ChartAreas[0].AxisY.Title =
"하";
276this.chart2.ChartAreas[0].AxisY.TextOrientation = TextOrientation.Horizontal;
288 슬롯 나라매개변수landreq = data.AddParameter(
"landreq", 2,
"작물별 토지 점유 기간(헥타르)");
289 foreach(DataGridViewRow 행
inthis.dataGridLandReq.Rows)
291문자열 기간 = (String)row.HeaderCell.Value;
292 for (
inti = 0; i < 행.Cells.Count; 나++)
293 if(row.Cells[i].값 !=
널&& !row.Cells[i].Value.Equals(
""))
294landreq.AddRecord(기간, this.dataGridLandReq.Columns[i].HeaderText).Value = Convert.ToDouble(row.Cells[i].Value);
297 슬롯 나라매개변수laborreq = data.AddParameter(
"노동요구", 2,
"작물 노동 요구량(헥타르당 노동일수)");
298 foreach(DataGridViewRow 행
에this.dataGridLaborReq.Rows)
300문자열 기간 = (String)row.HeaderCell.Value;
301 for (
inti = 0; i < 행.Cells.Count; 나++)
302 if(row.Cells[i].값 !=
널&& !row.Cells[i].Value.Equals(
""))
303laborreq.AddRecord(기간, this.dataGridLaborReq.Columns[i].HeaderText).Value = Convert.ToDouble(row.Cells[i].Value);
306 슬롯 나라매개변수수율 = data.AddParameter(
"수율", 1,
"작물 수확량(헥타르당 톤)");
307 슬롯 나라매개변수가격 = data.AddParameter(
"가격", 1,
"농작물 가격(톤당 달러)");
308 슬롯 나라매개변수miscost = data.AddParameter(
"잘못된 비용", 1,
"기타 현금 비용(헥타르당 달러)");
309 foreach(DataGridViewRow 행
inthis.dataGridYPM.Rows)
311 for (
inti = 0; i < 행.Cells.Count; 나++)
312 if(row.Cells[i].값 !=
널&& !row.Cells[i].Value.Equals(
""))
313data.GetParameter(row.HeaderCell.Value.ToString()).AddRecord(this.dataGridYPM.Columns[i].HeaderCell.Value.ToString()).Value = Convert.ToDouble(row.Cells[i].Value);
316data.AddParameter(
"땅", 0,
"농장 규모(헥타르)").
AddRecord().
값= Convert.ToDouble(this.textBoxLand.Text);
317data.AddParameter(
"부채", 0,
"고용 임금률(일당 달러)").AddRecord().Value = Convert.ToDouble(this.textBoxOwage.Text);
318data.AddParameter(
"트웨이지", 0,
"임시 노동 임금(일당 달러)").AddRecord().Value = Convert.ToDouble(this.textBoxTwage.Text);
322선택.
정의.추가(
"데이터", 데이터.이름);
323 GAMSJobj = ws.AddJobFromString(GetModelText());
329this.chart1.Series[
"토지 이용"].Points.AddXY(rec.Key(0), Rec.
레벨);
331사전<문자열, 이중> vals =
신규사전<string, double>();
333vals.Add(rec.Key(0), 0);
335vals[rec.Key(0)] = Rec.Value;
336 foreach(KeyValuePair<String, double> kv
in발)
337this.chart2.Series[
"totlanduse"].Points.AddXY(kv.Key, kv.Value);
339ClearDataGridView(this.dataGridCR);
341SetCellValue(this.dataGridCR, rec.Key(0), rec.Key(1), rec.Value);
343ClearDataGridView(this.dataGridViewLRS);
345SetCellValue(this.dataGridViewLRS, rec.Key(0), rec.Key(1), rec.Value);
349this.label4.Text =
"농장 수입 ($): "+ j.OutDB.GetVariable(
"yfarm").FindRecord().Level.ToString(
"0.####");
351this.button1.Enabled =
참;
354 공개 공허SetCellValue(DataGridView dgv, 문자열 rowHeader, 문자열 colHeader,
더블값)
356 foreach(DataGridViewColumn 열
에dgv.열)
358 if(col.HeaderText.Equals(colHeader))
360 foreach(DataGridViewRow 행
indgv.Rows)
362 if(row.HeaderCell.Value.Equals(rowHeader))
364row.Cells[col.Index].Value = 값;
371 공개 공허ClearDataGridView(DataGridView dgv)
373 for (
inti = 0; i < dgv.Columns.Count; 나++)
375 for (
intj = 0; j < dgv.Rows.Count; j++)
377dgv.Rows[j].Cells[i].Value =
"";
385c 작물 설정 / 밀, 클로버, 콩, 양파,
393매개변수 landreq(t,c) 작물별 토지 점유 개월수(헥타르);
394매개변수 노동요구량(t,c) 작물 노동 요구사항(헥타르당 인력);
398매개변수 수확량(c) 작물 수확량(헥타르당 톤)
400miscost(c) 기타 현금 비용(헥타르당 달러)
405famlab 가족 노동 가능(월당 일수) / 25 /
411$load landreq Laborreq 토지 빚 과세 수익률 가격 불일치
416변수 xcrop(c) 자르기 활동(헥타르)
426양수 변수 xcrop, flab ,fout, tlab
428방정식 landbal(t) 토지 수지(헥타르)
438landbal(t).. sum(c, xcrop(c)*landreq(t,c)) =l= 토지 ;
440laborbal(t).. sum(c, xcrop(c)*laborreq(t,c)) =l= flab(t) + tlab(t);
442flabor(t).. famlab =e= flab(t) + fout(t) ;
444arev.. 수익 =e= sum(c, xcrop(c)*yield(c)*price(c)) ;
446acost..mcost =e= sum(c, xcrop(c)*miscost(c)) ;
448alab.. labcost =e= sum(t, tlab(t)*twage) ;
450aout.. labearn =e= sum(t, fout(t)*owage) ;
452소득.. yfarm =e= 수익 + labearn - labcost - mcost ;
455모델 데모1 농장 노동 모델 / 모두 /
457yfarm을 최대화하는 lp를 사용하여 데모1을 해결하세요.
461크리프/토지 이용, 생산량, 수익 설정/
465매개변수 croprep 자르기 보고서 요약
468croprep('landuse',c) = xcrop.l(c);
469croprep('output',c) = xcrop.l(c)*yield(c);
470croprep('수익',c) = Croprep('출력',c)*가격(c);
471croprep(crep,'전체') = sum(c, Croprep(crep,c));
473labrep(t,'수요') = sum(c, xcrop.l(c)*laborreq(t,c));
474labrep(t,'패밀리') = flab.l(t);
475labrep(t,'임시') = tlab.l(t);
476labrep(t,'미사용') = -laborbal.l(t);
477labrep(t,'hire-out') = fout.l(t);
478labrep('total',lrep) = sum(t, labrep(t,lrep));
481totalLandUse(t) = sum(c, xcrop.l(c)*landreq(t,c))";